logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rinsky  
#1 Posted : Sunday, November 15, 2020 12:25:08 PM(UTC)
Rinsky

Rank: Advanced Member

Groups: Registered
Joined: 8/2/2013(UTC)
Posts: 450

Thanks: 38 times
Was thanked: 37 time(s) in 33 post(s)
I just tried to trigger OnCompletion with a video that runs on Mix2, so that it would change to something else when it is finished.

Unfortunately, right now it seems not to work if your video is not in Program1/Output1.

It would make sense to open this trigger to other Mixes as well.
BasilChessman  
#2 Posted : Saturday, November 21, 2020 12:49:36 PM(UTC)
BasilChessman

Rank: Member

Groups: Registered
Joined: 9/4/2020(UTC)
Posts: 20
United States

Was thanked: 1 time(s) in 1 post(s)
+1
Fl0  
#3 Posted : Friday, November 26, 2021 11:10:19 PM(UTC)
Fl0

Rank: Newbie

Groups: Registered
Joined: 4/24/2021(UTC)
Posts: 1
Germany
Location: Berlin

+1
AngusFindlay  
#4 Posted : Tuesday, November 30, 2021 5:11:25 AM(UTC)
AngusFindlay

Rank: Member

Groups: Registered
Joined: 8/24/2018(UTC)
Posts: 16
Location: Canada

Thanks: 2 times
+1 - It also doesn't trigger if a video is in a multiview layer.
Roy Sinclair  
#5 Posted : Thursday, December 23, 2021 6:39:40 AM(UTC)
Roy Sinclair

Rank: Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 25
United States
Location: Wichita

Thanks: 2 times
Was thanked: 6 time(s) in 5 post(s)
Originally Posted by: Rinsky Go to Quoted Post
I just tried to trigger OnCompletion with a video that runs on Mix2, so that it would change to something else when it is finished.

Unfortunately, right now it seems not to work if your video is not in Program1/Output1.

It would make sense to open this trigger to other Mixes as well.


I have a script I use that is triggered by an X-Key to play various MP3 files, it first checks to make sure no other MP3 is playing then turns off automatic actions that could cause it to be messed up if someone were to make it "Live" (which shouldn't happen but you never know when the cat is going to walk onto the keyboard) and then starts playing the MP3. It watches until it sees the MP3 has finished playing whereupon it resets the audio outputs.

The "watching for completion" code can be used with a video so you might be able to adapt this code to meet your needs.


Code:

'Script to be triggered by a Keypadkey or X-Key to start playing an MP3 as background audio

'  When you add a new MP3 player, you need to add it's key to this array
Dim PlayerKeys() as String = {"86fecea6-0bec-43b2-8989-4c548973b94f","a8bac9b2-0898-46ad-87b8-ef668d1f3147","0b59d4f0-a95d-4bbf-b6f5-3259045d8955","32fbcbd5-a1ff-4222-ac16-319c88b1d596","da73d4fd-0713-482b-966a-bd871c89f7a7","5700a5c0-a78d-4e7a-8848-23f11f4bcd34","c31f2b8b-0768-4e76-a0ab-f6668f1078a0","4c20abe9-e44b-4caa-8ab6-918bdb4704b3"}

Dim vMixState as new system.xml.xmldocument
vMixState.LoadXML(API.XML)

Dim PlayerNumber as integer = 0						' This is the only line that needs to be changed to change the player number, note it's zero based here and one based in the names
Dim PlayerKey as string = PlayerKeys(PlayerNumber)	' Get the Key for our player from the XML
Dim PlayerTitle as string = vMixState.SelectSingleNode("//input[@key='" & PlayerKeys(PlayerNumber) & "']/@title").Value	' Get the Title for our Player

' ----------- Check to make sure no MP3 player is currently running before we start another one ----------------------
Dim PlayerIndex as integer
Dim OKToPlay = true
For PlayerIndex = 0 to PlayerKeys.Length - 1
	Dim state as string = vMixState.SelectSingleNode("//input[@key='" & PlayerKeys(PlayerIndex) & "']/@state").Value
	if state = "Running"
		console.writeline(vMixState.SelectSingleNode("//input[@key='" & PlayerKeys(PlayerIndex) & "']/@title").Value & " is currently running, " & PlayerTitle & " cannot be started")
		OKToPlay = false
	'Else
	'	console.writeline("Player number " & CStr(PlayerIndex + 1) & " is not running")
	end if
Next

If OKToPlay   '  I would have liked to just quit executing in the above For statement if another player is running but there's no Quit statement implementation here so we have to use a honking big IF instead to bypass the functional code
	'-------------- 
	Dim MP3Player as Object = Input.Find(PlayerTitle)   ' Should use the Key but it's BROKEN!!!!!  so we have to use the Title instead
	console.writeline(PlayerTitle & " is now starting " & PlayerKey)

	' Configure Input to match requirements in case this is a newly added MP3 player - only needed once but doesn't hurt to change again
	MP3Player.Function("AutoPauseOff")			' Don't pause if someone sets this as "live" and then switches away from it, shouldn't happen but let's be safe
	MP3Player.Function("AutoPlayOff")			' Likewise don't start playing it if someone switches it "live"
	MP3Player.Function("AutoRestartOff")		' And don't restart it automatically either -- essentially we turn off the automatic actions
	MP3Player.Function("LoopOff")				' We are setting these to only play once, may need another script for repeat plays
	MP3Player.Function("AudioBusOff","M")		' Audio doesn't go to the master bus, it will get fed to the master through the local sound board
	MP3Player.Function("AudioBusOn","A")		' Audio goes to BUS A which feeds to our local sound board
	 
	' Now to set the MP3 to play

	MP3Player.Function("Restart")		' Make sure we play from the start
	MP3Player.Function("AudioOn")		' Turn on audio for this input
	MP3Player.Function("BusAAudioOn")	' Turn on Bus A to the sound board

	MP3Player.Function("Play")			' Start the MP3 playing (finally!)
	console.writeline ( PlayerTitle & " should be playing")

	Dim MP3IsPlaying as boolean = true
	Do While MP3IsPlaying				' Now we loop until the MP3 finishes playing
		sleep(1000)																											' Start the loop by waiting 1 seecond (1000 milliseconds)
		vMixState.loadxml( API.XML() )																						' Load that XML into a document tree 
		Dim Duration as string = vMixState.SelectSingleNode("//input[@key='" & PlayerKey & "']/@duration").Value				' Find the "Duration" of the MP3 (in milliseconds)
		Dim Position as string = vMixState.SelectSingleNode("//input[@key='" & PlayerKey & "']/@position").Value				' Find the current playing point of the MP3 (in millseconds)
		'console.writeline("Duration=" & Duration & "  Position=" & Position)
		If Duration = Position																								' If the position is the same as the duration then it's finished playing
			MP3IsPlaying = false																
		end if
	Loop

	console.writeline(PlayerTitle & " finished playing")

	MP3Player.Function("AudioOff")		' Done so turn off the audio for this input
	MP3Player.Function("BusAAudioOff")	' And turn off the input from Bus A (problematic, if we have any other input also playing through the local sound board!)

	console.writeline("Audio reset after " & PlayerTitle & " finished, script terminating")
end if 

David_in_Philly  
#6 Posted : Friday, January 7, 2022 12:19:41 PM(UTC)
David_in_Philly

Rank: Advanced Member

Groups: Registered
Joined: 11/21/2017(UTC)
Posts: 116
United States
Location: Philadephia, PA

Thanks: 29 times
Was thanked: 13 time(s) in 8 post(s)
+1
WaltG12  
#7 Posted : Saturday, January 8, 2022 12:30:08 PM(UTC)
WaltG12

Rank: Advanced Member

Groups: Registered
Joined: 7/4/2021(UTC)
Posts: 56
United States

Thanks: 1 times
Was thanked: 6 time(s) in 6 post(s)
Originally Posted by: Rinsky Go to Quoted Post
I just tried to trigger OnCompletion with a video that runs on Mix2, so that it would change to something else when it is finished.

Unfortunately, right now it seems not to work if your video is not in Program1/Output1.

It would make sense to open this trigger to other Mixes as well.


From the vMix help page:

Quote:
Restrictions

The Mix input is intended as a basic video mixer/switcher only, as a result the following features are not available:

...

Auto play/pause/restart of inputs. (This is to prevent unexpected situations where inputs are used by both the main mix and an input mix)


This would seem to be open to presenting the same issue that they've taken deliberate steps to avoid, would it not?
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.