Rank: Advanced Member
Groups: Registered
Joined: 11/23/2020(UTC) Posts: 170 Location: Wichita Thanks: 10 times Was thanked: 24 time(s) in 20 post(s)
|
Originally Posted by: rolahoodriver I would agree. We have two timers set for this and would like to create a video that starts 2 minutes or so before service starts. {0:6:30 PM|HH:mm:ss} can not be triggered from anything as its going off of system time. Here's the countdown to service start code we use to control when the streaming starts, when the recording starts, all the transitions (play an animated logo, switch to camera in Preview) when the service starts and plan to do more things later when I get the time to write the code (and the need, plus some external hardware changes). This code also does a true countdown giving Hours, Minutes and Seconds until the service starts instead of the backwards "countdown" by changing the title in our countdown screen (a multiview screen with an animated background image, a countdown bar, Title bar announcing who we are and a nice large window in which the announcement slides are played and in which a pre-service video could also be played (future plans). The script is started by a trigger on the Countdown screen so when the countdown screen is made Live the script starts. Note that you could add anything you need in the countdown process including switching to other screens and back since the script won't start a second time if it's already running.
'Countdown to Service start Script
' vMix Inputs - All will be referenced using their unique "key" (GUID) which will only change if the input is deleted and then added again, otherwise changing the name or input number will not affect this script Dim WhichCountdownScreen() as string = {"17abeafe-9243-45a7-879d-94491046b873","b843684a-de64-4b1f-9fd9-bee3316c47c9"} Dim CountdownScreen as string Dim WhichCountdownTitle() as string = {"3e500d73-872c-4841-aa5c-67ebbf46d486","610f7530-72ff-4449-9180-cd4f9d0a4dc2"} Dim CountdownTitle as string Dim CountdownTitleText as string Dim CountdownBackgroundMusic as string = "d34761a6-5c99-4bbd-acb8-6e4561d31eaf" Dim AudioFeedFromSoundBoard as string = "57d87e62-8130-4b7a-a893-741d6c6c6472" Dim VideoFeedFromLaptop as string = "d257b307-e475-4aa9-abe6-6f03e9684d57" ' Has Alpha channel to caption worship songs Dim AnnouncementsFromLaptop as string = "5b5a4a6e-6f12-41ec-9bf0-0b5b29886be3" ' No alpha channel for use in countdowns Dim AnimatedLogo as string = "0f22c6b3-626f-40ef-910c-1b406ca55cd1" Dim LiveOutput as string = "a961fbe3-55d7-40d9-bbd5-33922aa60a3f"
' Wednesday Night Bible Study begins in {0:07:00 PM|mm:ss} ' Sunday Service begins in {0:10:00 AM|mm:ss}
Dim ServiceTime as string Dim StreamingStartTime as string Dim DayOfWeek as string = DateTime.Now.ToString("ddd")
Dim dtServiceTime as DateTime Dim dtStreamingStartTime as DateTime
If DayOfWeek = "Sun" Then CountdownScreen = WhichCountdownScreen(0) CountdownTitle = WhichCountdownTitle(0) CountdownTitleText = "Sunday Service begins in " dtServiceTime = new DateTime(Datetime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ,10,00,00) dtStreamingStartTime = new DateTime(Datetime.Now.Year, DateTime.Now.Month, DateTime.Now.Day ,09,45,00) End If If DayOfWeek = "Wed" Then CountdownScreen = WhichCountdownScreen(1) CountdownTitle = WhichCountdownTitle(1) CountdownTitleText = "Wednesday night Bible Study begins in " dtServiceTime = new DateTime(Datetime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 18,30,00) ' yyyy,mm,dd,hh,mm,ss - 24 hour time dtStreamingStartTime = new DateTime(Datetime.Now.Year,DateTime.Now.Month, DateTime.Now.Day, 18,20,00) End If
StreamingStartTime = dtStreamingStartTime.ToString("hh:mm") ServiceTime = dtServiceTime.ToString("hh:mm") console.writeline ( "ServiceTime=" & ServiceTime & " Stream starting time=" & StreamingStartTime & " Current time=" & DateTime.Now.ToString("hh:mm")) API.Function("Restart",CountdownBackgroundMusic) API.Function("Play",CountdownBackgroundMusic) 'API.Function("ScriptStart","BugOnBugOff") ' No key (GUID) for scripts in vMix API.Function("CutDirect",CountdownScreen) API.Function("AudioOff",AudioFeedFromSoundBoard) API.Function("AudioOn",CountdownBackgroundMusic) API.Function("SetOutput2",CountdownScreen) API.Function("SetOutput3",CountdownScreen) API.Function("OverlayInput3Off") ' Make sure that we don't have the Slideshow coming up in the "Song lyrics" overlay zone
' Main timer Loop ' ' We check for everything that needs to happen during the countdown in this loop: ' 1. End of the countdown ' 2. Time to start streaming (15 mins before end of countdown as of this comment being written) ' 3. Optional video announcements (timed to end at 2 minutes before the end of the countdown) ' pending not implemented ' 4. MIDI note for DMX Control to dim house lights 30 seconds before service start (need house lights on DMX first!) ' pending not implemented ' 5. MIDI note for DMS control to flash stage lights 30 seconds before video announcements ' pending not implemented ' 6. MIDI note for DMX control to blank stage lights at start of video announcements ' pending not implemented ' 7. MIDI note for DMX control to restore stage lights at end of video announcements ' pending not implemented '
Do While True If ServiceTime = DateTime.Now.ToString("hh:mm") Then ' The times match so exit the loop! Exit do End If If StreamingStartTime = DateTime.Now.ToString("hh:mm") Then ' Time to start the streaming API.Function("StartStreaming","0") End If ' Here we will update the countdown time in the "HeadlineText" of the countdown screen Dim tsHowLong as TimeSpan = dtServiceTime - DateTime.Now Dim stHowLong as String = tsHowLong.ToString.Substring(0,8) If stHowLong.Substring(0,2) = "00" Then stHowLong = stHowLong.Substring(3,5) End If API.Function("SetText",Input:=CountdownTitle,SelectedName:="Headline.Text",Value:= CountdownTitleText & stHowLong) 'console.writeline("Time Left = " & TimeLeft & " Hours left " & Hoursleft & " Minutes left " & CStr(MinutesLeft) & " Seconds left " & Secondsleft) sleep(1000) ' Sleep for one second Loop
Console.writeline("Starting service") API.Function("AudioOff",CountdownBackgroundMusic) API.Function("Pause",CountdownBackgroundMusic) API.Function("AudioOn",AudioFeedFromSoundBoard) API.Function("StartRecording") API.Function("SetOutput2",LiveOutput) API.Function("Setoutput3",VideoFeedFromLaptop) API.Function("CutDirect",AnimatedLogo)
' Because I often forget to turn it on we'll wait one minute while Powerpoint is exited and ProPresenter is turned on then display the song subtitles ' of course that assumes someone remembers to get the Laptop ready for the song service --- but we only do this on Sunday, not Wednesday
If DayOfWeek = "Sun" Then sleep(60000) ' Wait one Minute API.Function("OverlayInput3",VideoFeedFromLaptop) End If
|