bitfocus / companion-module-studiocoast-vmix

Studiocoast vMix module for Bitfocus Companion
MIT License
32 stars 10 forks source link

vMix countdown timer Time Remaining variable for trigger conditions #265

Closed knbpixels2 closed 2 months ago

knbpixels2 commented 2 months ago

Describe the feature Pull in the time remaining for a countdown timer and use it as a variable when creating a trigger condition. We already have time remaining of a countdown as a variable for buttons, would love to have it for triggers as well.

I understand that vMix may be reporting the time remaining as a text string perhaps and that's why we don't have it as a trigger variable, but if that's the case could maybe it be translated into timecode?

Is this version dependent (vMix v24.)? No

If documentation is required to implement, do you know where to find it? N/A

Usecases With this feature users would be able to create a condition that drives a trigger, for example....when a countdown reaches 30 seconds remaining, the condition becomes true, and an action such as Playback of an audio or video input is performed.

thedist commented 2 months ago

Why can you not simply use the internal Internal: Variable: Check value, or Internal: Variable: Check boolean expression, conditions? That's how people so far have been having triggers fire when timers reach a certain value, or are within a certain range.

For example I have a variable $(vmix:input_countdown_layer_2_titletext}, if it's just displaying seconds I could do an Event for On variable change, a condition to check the value for 30 and that will fire when that variable changes and has the value of 30. If it was minutes and seconds I'd check the value 00:30 or however it may be set to be displayed by that title. If more complex conditions are needed, then the Check boolean expression would allow for expression functions such as timestampToSeconds to turn a timestamp 00:00:00 into just seconds, which could be evaluated in other ways if needed.

knbpixels2 commented 2 months ago

I tried this as well and couldn't get it to work...I have now remade the trigger doing as you describe and still not working, but maybe I'm doing something wrong on the Events section? I've tried "On Condition becoming true" as well as "On variable change", with my timer variable pasted in: "$(vmix:input_timertest_layer_0_titletext)", which I can see displaying the countdown time as it runs on the variable tab. So I know the variable is good.

Then in the condition I have Internal: Variable: Check Value, using that same variable expression, Operation is =, and value is 00:00:30, which matches the format of the countdown.

But at that mark in the countdown, the action is not triggered. The action works, based on the Test button. The test action is to change the background color of a button.

I tried Boolean for a moment but I'm not confident I was doing that correctly, didn't work anyway

thedist commented 2 months ago

So your Trigger is set up like the following:

chrome_ttg412la7z

With the correct Variable set as the On variable change Event, the correct Variable and Value set as the internal: Variable: Check value condition, and also that the trigger itself on the list of triggers is set to Enabled?

In my quick test there I have a countdown on layer 0 of input 11, it's just using minutes and seconds so my condition just uses minutes and seconds, but if yours uses hours make sure you have it exactly as the countdown will show.

knbpixels2 commented 2 months ago

Ah ok, I see where I went wrong...I was using a variable from the variables tab, not that specific layer 0 variable you're referencing...I got it working now, thank you! It would be really nice if vMix could just add a trigger for OnCountdownTime in addition to the existing OnCountdownCompleted, so we don't have to come up with workarounds. I appreciate your help!

knbpixels2 commented 2 months ago

So your Trigger is set up like the following:

chrome_ttg412la7z

With the correct Variable set as the On variable change Event, the correct Variable and Value set as the internal: Variable: Check value condition, and also that the trigger itself on the list of triggers is set to Enabled?

In my quick test there I have a countdown on layer 0 of input 11, it's just using minutes and seconds so my condition just uses minutes and seconds, but if yours uses hours make sure you have it exactly as the countdown will show.

I thought I had it working, and it does work for something like a countdown for a specified time interval. But it seems like this method does not work when using "Countdown to Time".

See screenshot below....the layer 0 Title Text variable is pulling from the dynamic text field being generated by vMix, which on a typical countdown is determined by the time interval you specified in the setting. But when you use Countdown to Time that dynamic text area is populated by the parameters that determine the time to count to and the format. So when the variable is pulling in the Title Text, it's pulling that, instead of the countdown that is being shown on the input. So the trigger won't fire because the variable doesn't match the value I'm putting into the trigger

image image

thedist commented 2 months ago

Unfortunately there's absolutely nothing we can do about that. When using countdown to specific time, vMix's API doesn't show us what is actually being displayed on the title, so if you have a countdown to {0:11:36 PM|mm:ss} the API shows us exactly that string and not what the actual time remaining is.

All I can suggest for that usecase is to submit a feature request on vMix's forums to add the actual time remaining being displayed in the API, which would allow 3rd party apps like Companion to use that data. Or depending on your needs you may be able to use the Time of Day Event within Companion triggers and having Companion trigger off of the time of day, rather than compare vMix's countdown, but be aware though if Companion and vMix are on different machines their clocks may not be exactly in sync.

knbpixels2 commented 2 months ago

That's too bad, thanks for the info!