Input helpers

Includes lookup, media playback control (handles MediaFileInput, AudioFileInput, and CavPlayerInput uniformly), and generic reflection-based property/command access.

Function Returns Description
GetNamedModel(modelName) NamedModel or null Returns the named model from NamedModels, or null if no match exists.
SetObjectProperty(op, propertyName, value) bool Sets a property on the given object using reflection and TypeDescriptor-based invariant-culture string conversion. Returns false if the object is null, the property does not exist, or conversion fails.
SetObjectProperty(targetName, propertyName, value) bool Resolves a named model via GetNamedModel and sets a property on it using reflection and invariant-culture string conversion. Returns false if the target name or property name is empty, the target is missing, or conversion fails.
CallObjectFunction(op, functionName, values) object or false Invokes a method on the given object using reflection. Returns the method's return value on success, or false if the object is null, the function name is empty, the method does not exist, or invocation throws.
GetObjectProperty(op, propertyName) object or null Reads a property value from the given object using reflection. Returns null if the object is null, the property name is empty, or the property does not exist.
GetInputByName(name) AbstractInput or null Returns the input with the given name, or null if no input matches.
GetInputById(Id) AbstractInput or null Returns the input whose Id matches the given GUID string, or null if no input matches.
GetMovieInputByName(name) MediaFileInput or null Returns the named input as a MediaFileInput, or null if no input matches the name or the matched input is a different type.
StartMediaPlayBack(name) bool Starts playback on the named media input. Supports MediaFileInput, AudioFileInput, and CavPlayerInput. Returns true if a Play command was dispatched; false if the input is missing, of a different type, or its play command is not currently executable.
ScheduleMediaPlayBack(name, delayMs) bool Schedules a delayed start of a media input. The input must exist and be a MediaFileInput, AudioFileInput, or CavPlayerInput. Only one scheduled start per input is allowed at a time; subsequent calls for the same input are ignored until the pending entry fires or is cleared via ClearScheduledMediaPlayBacks. The scheduled start fires only while the project's PlaybackState is Running.
ScheduleMediaStop(name, delayMs) bool Schedules a delayed stop of a media input. The input must exist and be a MediaFileInput, AudioFileInput, or CavPlayerInput. Only one scheduled stop per input is allowed at a time; subsequent calls for the same input are ignored until the pending entry fires or is cleared via ClearScheduledMediaPlayBacks. Scheduled starts and stops are tracked independently — an input may have one of each pending. The scheduled stop fires only while the project's PlaybackState is Running.
ClearScheduledMediaPlayBacks() bool Clears every pending scheduled media start and stop, regardless of input. Also invoked from Clear so a project switch never leaves stale scheduled actions behind.
StopMediaPlayBack(name) void Stops playback on the named media input on a background Task (fire-and-forget). Supports MediaFileInput, AudioFileInput, and CavPlayerInput. No-op if the input is missing, of a different type, or its stop command is not currently executable.
PauseMediaPlayBack(name) bool Pauses playback on the named media input. Supports MediaFileInput, AudioFileInput, and CavPlayerInput. Returns true if a Pause command was dispatched; false if the input is missing, of a different type, or its pause command is not currently executable.
MediaIsPlaying(name) bool Returns true if the named media input exists and its MediaPlayerState is Playing. Returns false otherwise (including when the input is missing or not a media file/audio/CAV input).
ExecuteInputCommand(selectedInput, buttonName) bool Executes a named Command button on the given AbstractInput, using reflection. Returns true only if the command was found and executed successfully.
CheckIfAllMediaFileInputsArePlaying(minSeconds) bool Returns true if all media file inputs in the project are currently playing and have played for at least the specified number of seconds. Designed for polling from OnRenderFrame in test scripts to wait for media files to be ready before performing actions that depend on them.
function OnConnectorPlayLogo() {
    Project.StartMediaPlayBack("LogoAnimation.mov");
    return "Logo started";
}