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: string) |
NamedModel or null |
Returns the named model from NamedModels, or null if no match exists. |
SetObjectProperty(op: object, propertyName: string, value: string) |
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: string, propertyName: string, value: string) |
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: object, functionName: string, values: object[]) |
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: object, propertyName: string) |
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: string) |
AbstractInput or null |
Returns the input with the given name, or null if no input matches. |
GetInputById(Id: string) |
AbstractInput or null |
Returns the input whose Id matches the given GUID string, or null if no input matches. |
IsSrtSyncGroupLocked() |
bool |
Returns true when the SRT input synchronization group is locked and every participating input is in sync (Locked or Fallback). Use in a .js autotest to assert that all synchronized SRT inputs have converged. Returns false when no inputs are synchronizing. |
GetSrtSyncMemberCount() |
int |
Number of SRT inputs currently participating in synchronization. |
GetSrtSyncLockedMemberCount() |
int |
Number of synchronized SRT inputs currently locked to the group (includes fallback-locked). |
GetSrtSyncTimeCode(inputName: string) |
string |
The source timecode a synchronized SRT input is currently emitting (e.g. "21:24:02:24f"), or an empty string if the input isn't in the group or hasn't read a timecode yet. Two genlocked inputs that are in sync report the same value. |
GetSrtSyncStatusJson() |
string (JSON) |
Full SRT synchronization status as a JSON string: group Locked/TargetFrameNo/GroupLatencyFrames/ CongestionPolicy/MemberCount/LockedMemberCount plus a Members array (Name, TimeCode, State, OffsetFrames, BufferedFrames, UsingFallback). Handy for logging from a .js autotest. |
GetMovieInputByName(name: string) |
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: string) |
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: string, delayMs: int) |
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: string, delayMs: int) |
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: string) |
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: string) |
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: string) |
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(inputObject: object, commandPropertyName: string) |
bool |
Executes a Command button on an input, equivalent to clicking the button in the property panel. inputObject is the input instance to act on, typically obtained via GetInputByName. commandPropertyName is the case-sensitive property name of the command, as listed on the input's page under Script Engine Objects — the property name, not the label shown on the button. Returns true if the command was found and executed; otherwise false, including when the object is not an input, no command with that name exists, or the command is currently disabled. See the example below. |
CheckIfAllMediaFileInputsArePlaying(minSeconds: int) |
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";
}
Reading an input's source summary
Every input object answers GetPreviewSummary() with the one-line description Composer Desktop shows under the input's preview on the Inputs tab — for example 1920 × 1080 · 29.97 fps · h264 / aac for a video file, or aac · 48 kHz · 2 ch for an audio file. It returns an empty string while a file is still loading and when the input has nothing to report, never null. What it contains depends on the input type; see Selected input preview for the list.
function DescribeInput(inputName) {
var input = Project.GetInputByName(inputName);
if (input === null)
return "No input named " + inputName;
return input.GetPreviewSummary();
}
The text is meant for people, not for parsing: to act on a resolution or a frame rate, read the input's own properties instead.