roVideoPlayer

 

This object is used to play back video files (using the generic ifMediaTransport interface). If the message port is set, the object will send events of the type roVideoEvent. All object calls are asynchronous. That is, video playback is handled in a different thread from the script, and the script will continue to run while video is playing. Decoded video will be scaled to the output resolution specified by roVideoMode. The JavaScript equivalent is to use <video> elements with BrightSign properties.

To display video in a zone/window, you must call SetRectangle(). In firmware versions 6.0.x and later, zone support is enabled by default.

ifVideoControl

PlayStaticImage(filename As String) As Boolean

Uses the video decoder to display an image. On 4Kx42, XT3, XD3, HD4, XD4, XT4, XC5, XT5, XD5, HD5, and LS445 models, you can use the video decoder to display 4K images.

PlayStaticImage(parameters As roAssociativeArray) As Boolean

Uses the video decoder to display an image. The passed associative array can contain the following parameters:

  • Filename: The name of the image file

  • EncryptionAlgorithm: The file-encryption algorithm. Currently the options are "AesCtr" and "AesCtrHmac".

  • EncryptionKey: The key to decrypt the image file. This is a byte array consisting of 128 bits of key, followed by 128 bits of IV.

See the Image Decryption section in the roImagePlayer entry for details on displaying encrypted images.

Important

The video player no longer accepts "{A|A}" AES encryption keys (i.e. where the top and bottom 64 bits of the key are identical).

SetViewMode(mode As String) As Boolean 

Sets the scaling of the video in relation to the video window. The passed string can be one of the following values:

  • "ScaleToFit": Scales the video to fill the window. The aspect ratio of the source video is ignored, so the video may appear stretched/squashed.

  • "LetterboxedAndCentered": Letterboxes and centers the window. The aspect ratio of the source window is maintained.

  • "FillScreenAndCentered": Scales the video to fill the window. The aspect ratio is maintained, so the video may appear cropped. This is the default behavior.

  • "Centered": Centers the window.

View modes rely on correct aspect-ratio marking from video files, and some files may be marked incorrectly.

SetRectangle(r As roRectangle) As Void

Specifies the placement and dimensions of the video window using a passed roRectangle instance.

Hide() As Boolean

Hides the video window.

Show() As Boolean

Shows the video window.

EnableSafeRegionTrimming(enable As Boolean) As Boolean
 
AdjustVideoColor(parameters As roAssociativeArray) As Boolean

Adjusts the video and graphics output of the player using the following parameters, which can be passed to the method as an associative array: "brightness", "hue", "contrast", "saturation". Each parameter has a default value of 0 and can accept a range of values between -1000 and 1000.

SetKeyingValue(keying_settings As roAssociativeArray) As Boolean 

Applies a mask to each pixel in the video window. If the pixel value falls within the specified range of chroma and luma key values, the pixel will appear transparent, allowing video and graphics behind it to show through. If the pixel value does not fall within the specified range, the pixel is unaltered. The chroma and luma key values are set using integers contained in the passed associative array:

  • luma

  • cr

  • cb

Each integer value is arranged as follows: [8 bits of mask][8 bits of high-end range][8 bits of low-end range]. For example, an 0xff8040 value for luma would mask luma at 0xff (no change) and then apply a range from 0x40 to 0x80 for changing to transparent alpha. Note that chroma and luma keying work well with simple shapes and patterns, while complex patterns like hair or grass will not be masked effectively.

SetTransform(transform As String) As Boolean 

Applies one of eight transforms to the video plane. This method works equally well with all video sources (files, streams, HDMI® input) and can be called separately on multiple roVideoPlayer instances. Calls to this method only take effect when the next file/source is played, and transitions to a transformed video do not take place seamlessly.

  • "identity": No transformation (default behavior)

  • "rot90": 90 degree clockwise rotation

  • "rot180": 180 degree rotation

  • "rot270": 270 degree clockwise rotation

  • "mirror": Horizontal mirror transformation

  • "mirror_rot90": Mirrored 90 degree clockwise rotation

  • "mirror_rot180": Mirrored 180 degree clockwise rotation

  • "mirror_rot270": Mirrored 270 degree clockwise rotation

The coordinates and dimensions of the roRectangle instance containing the video are not affected by rotation.

GetFilePlayability(filename As String) As roAssociativeArray

Returns an associative array indicating the playability of the video file. For the following keys, a "playable" value indicates that the component is playable, while a "no media" value indicates that there is no media—any other value indicates that the media is unplayable.

  • audio: The audio file associated with the video

  • video: The video file associated with the video

  • file: The video container file

GetProbePlayability(probe_string As String) As roAssociativeArray

Returns an associative array indicating the playability of the probe string. For the following keys, a "playable" value indicates that the component is playable, while a "no media" value indicates that there is no media—any other value indicates that the media is unplayable.

  • audio: The audio file associated with the video

  • video: The video file associated with the video

  • file: The video container file

GetStreamInfo() As roAssociativeArray

Returns an associative array containing information about the current video. To retrieve metadata about a video file that is not currently playing, use the ProbeFile() method instead. The associative array can contain the following parameters:

  • [string] Source: The URI of the video file

  • [string] SrcAddress: The source IP address of the video stream

  • [string] DstAddress: The multicast address on which the IP stream is being transmitted. This value may be absent if the RTSP service has not redirected the stream (in this case, the IP address of the player may be displayed instead).

  • [string] Encapsulation: The encapsulation of the video. This value can be "ES" (elementary stream), "TS" (transport stream), or "UNKNOWN" for streaming video.

  • [string] AudioFormat: The format of the audio file

  • [int] AudioSampleRate: The audio sample rate (in hertz)

  • [int] AudioChannelCount: The number of audio channels

  • [int] AudioDuration: The duration of the audio track (in milliseconds)

  • [string] VideoFormat: The format of the video file

  • [int] VideoFramerate: The video frame rate (in frames per second)

  • [int] VideoColorDepth: The color depth of the video (in bits)

  • [int] VideoWidth: The width of the video (in pixels)

  • [int] VideoHeight: The height of the video (in pixels)

  • [float] VideoAspectRatio: The aspect ratio of the video

  • [int] VideoDuration: The duration of the video (in milliseconds)

  • [int] PreferredVideo: The current preferred video track, as determined by the SetPreferredVideo() method

  • [int] PreferredAudio: The current preferred audio track, as determined by the SetPreferredAudio() method

  • [int] PreferredSubtitle: The current preferred subtitle track, as determend by the SetPreferredCaptions() method

  • [roArray] Programs: A list of programs that are part of the video. Each entry contains the program ID, along with indicies of video, audio, and subtitle tracks that are part of the program. These track lists can be used–along with the VideoAudio, and Subtitle parameters and the SetPreferred<>() methods–to scan and select tracks. Each entry can contain the following parameters:

    • [int] ProgramId: The program ID

    • [roArray] Video: An index of integers corresponding to video tracks that are part of the program

    • [roArray] Audio: An index of integers corresponding to audio tracks that are part of the program

    • [roArray] Subtitle: An index of integers corresponding to subtitle tracks that are part of the program. To retrieve more information about an individual video/audio/subtitle track, use the integer value to look up the associated Video/Audio/Subtitle index (e.g. print streaminfo.subtitle[streaminfo.programs[0].subtitle[1]])

  • [roArray] Video: A list of video tracks that are part of the video. Each entry in the list is an associative array with the following parameters:

    • [float] AspectRatio: The aspect ratio of the video track

    • [string] Name: The name of the video track

    • [int] Width: The video width (in pixels)

    • [int] Height: The video height (in pixels)

    • [int] ColorDepth: The aspect ratio of the video track

    • [int] Duration: The duration of the video track (in milliseconds)

    • [int] Program: The ID of the program to which the video track belongs

    • [float] FrameRate: The framerate of the video track

    • [int] Pid: The packet identifier (PID) of the video track

    • [string] Format: The format of the video track

  • [roArray] Audio: A list of audio tracks that are part of the video. Each entry in the list is an assocative array with the following parameters:

    • [string] Name: The name of the audio track

    • [int] ChannelCount: The number of audio channels

    • [string] Format: The format of the audio track

    • [int] Pid: The packet identifier (PID) of the audio track

    • [int] Program: The ID of the program to which the audio track belongs

    • [int] Duration: The duration of the audio track (in milliseconds)

    • [int] SampleRate: The audio sample rate (in hertz)

    • [string] Language:  A code specifying the language of the audio track (e.g. "eng", "spa"). The language codes are specified in the ISO 639-2 standard.

  • [roArray] Subtitle:  A list of subtitle tracks that are part of the video. Each entry in the list is an assocative array with the following parameters:

    • [string] Language: A code specifying the language of the subtitle track (e.g. "eng", "spa"). The language codes are specified in the ISO 639-2 standard.

    • [int] Program: The ID of the program to which the subtitle track belongs

    • [int] Pid: The packet identifier (PID) of the subtitle track

    • [string] Type: The encoding standard of the subtitles (e.g. "CEA708", "DVB")

GetStreamStatistics() As roAssociativeArray

Returns an associative array containing statistics associated with the IP stream. The associative array contains the following parameters:

  • [int] Bitrate: The video bitrate

  • [int] NumDisplayed: The number of video frames displayed. This is based on the refresh rate of the monitor.

  • [int] NumUnderflowed: The number of times the video FIFO has under-flowed. This usually indicates that the buffer size needs to be increased.

  • [int] NumDecodeErrors: The number of video frames with decode errors

  • [int] NumDecoded: The total number of video frames decoded

  • [int] NumAudioDecoded: The total number of audio frames decoded

  • [int] NumAudioDecodeErrors: The number of audio frames with decode errors

  • [int] NumAudioDummy: The total number of missing audio frames. This value will increment when an audio frame goes missing or a timestamp is incorrect. A couple of frames will often be registered when streaming begins.

  • [int] NumAudioUnderflows: The number of times the audio FIFO has under-flowed. This usually indicates that the buffer size needs to be increased.

  • [int] VideoFramesPerSecond: The video frame rate (in frames per second)

  • [int] VideoInterlaced:  Indicates whether the video frames are interlaced or progressive

  • [bool] HardwareDecode:  Indicates whether or not the player is using hardware acceleration. This is always true for Series 4 players, but Series 5 players may report false if the player can’t use hardware acceleration for the media. Software decode is not recommended and is only used when the player can’t use hardware acceleration for a media file.

ON THIS PAGE

GetCrc() As Integer

Returns the CRC of the Y and Cb signals as a single integer. This method allows the script to compare two moments in the video-window output: If the return values differ, then the output is not identical.

SetPreferredVideo(description As String) As Boolean

Chooses a video stream from the video input based on the parameters in the passed string.

SetPreferredAudio(description As String) As Boolean

Chooses an audio stream from the video input based on the parameters in the passed string.

SetPreferredCaptions(description As String) As Boolean

Chooses a data stream from the video input based on the parameters in the passed string.

SetOpacity(opacity As Integer) As Boolean

The range of opacities from 0 to 255 (fully transparent to fully opaque).

ifMediaTransport

PlayFile(source As Object) As Boolean

Plays a video file or HDMI Input. To play a file, pass a string specifying the file name and path. To play HDMI Input, pass an roVideoInput instance.

PlayFile(parameters As roAssociativeArray) As Boolean 

Plays video using the parameters passed as an associative array. All settings specified with this method are transient: They will only last for the duration of the file/stream playback. To specify persistent settings, use the SetProperties() method or the equivalent "Set" methods (SetTransform()SetViewMode(), etc.).

  • AudioDelay: A user-controllable delay for audio in milliseconds.

  • Decoder: The decoder_hint used by mosaic mode to suggest which decoder to use.

  • EncryptionAlgorithm: The encryption algorithm to use for encrypted playback

  • EncryptionKey: The encryption key to use for encrypted playback

  • FadeInLength: The length (in milliseconds) of fade-in at the beginning of the media

  • FadeOutLength: The length (in milliseconds) of fade-out at the end of the media

  • Filename: The name/path of a file to be used for playback

  • LoopMode: The looping mode for media playback. See the SetLoopMode() entry for a list of applicable values.

  • NoForceCapture: A boolean value. If true, video capture to DRAM is bypassed when frame-rate conversion is not required. This reduces decode-to-display latency but introduces the following limitations:

    • Transform values other than "identity" will not work.

    • Screenshots may not be correct.

  • NoReordering: Improves latency but disables playback of B-slices

  • Preload: Start playback paused at the start.

  • ProbeString: Used by BrightAuthor:connected to supply a probe hint which may accelerate stream startup in some cases.

  • StreamFadeIn: The length (in milliseconds) of audio/video fade-in for streams. This operates independently of hwz "fade".

  • Transform: The rotation of the video. See the SetTransform() entry for a list of applicable values.

  • VideoDelay: A user-controllable delay for video in milliseconds.

  • ViewMode: The view mode of the video window. See the SetViewMode() entry for a list of applicable values.

  • ZIndex: Control the z-index of the video layers.

These parameters are specifically used for streaming:

  • AudioFifoSize: Set the audio FIFO size (ACDB).

  • StreamBufferSize: Demux input buffer size (in bytes).

  • StreamJitter: The jitter threshold for the stream in milliseconds. If the timing of incoming packets exceeds this value then the stream STC will be re-centered so as to remain in sync.

  • StreamLatency: The amount of deviation (in milliseconds) from the default latency value: For example, a value of -500 will reduce the latency by half a second; a 500 value will increase the latency by half a second; and a 0 value will specify the default latency. Specifying a negative value will not change the buffer size; instead, it will give the buffer less time to fill up before playback begins. Usable values extend to approximately -750, though this value may differ depending on the network environment. Reducing the latency too much will result in obvious playback stutter.

  • StreamLowLatency: Low-latency mode for RTSP streams. Setting this parameter to True will achieve the lowest possible latency for a stream, but at a reduced maximum bitrate.

  • StreamMaxBitrate: Sets the maximum allowed bitrate (in bytes) for adaptive (HLS) playback.

  • StreamPollInterval: Gives fine control of how often streams are polled (checked for freezing)

  • StreamProbe: The stream probe type. This parameter can be set to "deep" (to include video dimensions, audio sample rate, etc.) or "shallow".

  • StreamTimeout: Stop searching for the stream after this amount of time (in milliseconds).

  • StreamTrace: Turns on stream debugging

  • StreamUsePcrClock: Use recovered PCR as timebase for unrecognized stream protocols. This should be selected when using an external GStreamer component where the PCRs arrive at the correct time similar to RTP or UDP.

  • Url: The URL of a video stream to be used for playback

  • VideoFifoSize: Set the video FIFO size (VCDB).

These parameters are for MJPEG only:

  • Greyscale: Boolean. Sets MJPEG stream to greyscale.

  • Rotate: 0, 90, 180, or 270 degrees. If possible, use Transform instead.

These parameters are used to set they keying value of the video (see the SetKeyingValue() entry for more details)

  • CbKey

  • CrKey

  • LumaKey

These parameters are used to play encrypted video:

  • EncryptionAlgorithm

  • EncryptionKey

These parameters are used to parse preferred streams:

  • PreferredAudio

  • PreferredCaptions

  • PreferredVideo

These parameters are used in conjunction with the roSyncManager object to synchronize playback:

  • SyncDomain

  • SyncId

  • SyncIsoTimestamp

These parameters are used for multiscreen playback:

  • MultiscreenHeight

  • MultiscreenWidth

  • MultiscreenX

  • MultiscreenY

  • SourceHeight

  • SourceWidth

  • SourceX

  • SourceY

SetProperties(parameters As roAssociativeArray) As Boolean 

Sets persistent properties for video playback. These properties can be temporarily overridden by the parameters in a PlayFile()  call. See the PlayFile() entry for a list of available parameters.

GetProperties() As roAssociativeArray

Returns the current video-playback properties as an associative array. See the PlayFile() entry for a description of parameters.

SetPropertiesString(parameters As String) As Boolean

Sets persistent properties for video playback using a comma-separated list. These properties can be temporarily overridden by the parameters in a PlayFile() call. See the PlayFile() entry for a list of available parameters.

Example
vp = CreateObject("roVideoPlayer") vp.SetPropertiesString("Transform=rot90,StreamLowLatency=true") 
GetPropertiesString() As String

Returns the current video-playback properties as a string (e.g. "<key>=<value>, <key>=<value>"). See the PlayFile() entry for a description of parameters.

SetPlaybackSpeed(speed as Float) As Boolean

Modulates the playback speed of the video, using the float 1.0 as the value for standard playback speed. To fast-forward the video, pass a value greater than 1.0; to rewind the video, pass a negative value. A value between 0 and 1.0 will the play the video in slow motion.

PreloadFile(parameters As roAssociativeArray) As Boolean
Play() As Boolean

Plays the currently loaded file or stream.

Stop() As Boolean

Stops playback of the currently loaded file or stream.

StopClear() As Boolean 

Stops video playback and clears the currently loaded file or stream.

Pause(parameters As roAssociativeArray) As Boolean

Pauses the video file or stream. This method accepts an optional associative array containing the following parameter:

  • SyncIsoTimeStamp: The time stamp for pausing synchronized video. This value is provided by the roSyncManager.Synchronize() method on the leader unit and the roSyncManagerEvent.GetIsoTimeStamp() method on follower unit(s).

Resume(parameters As roAssociativeArray) As Boolean

Resumes a paused video file or stream. This method accepts an optional associative array containing the following parameter:

  • SyncIsoTimeStamp: The time stamp for resuming synchronized video. This value is provided by the roSyncManager.Synchronize() method on the leader unit and the roSyncManagerEvent.GetIsoTimeStamp() method on follower unit(s). 

SetLoopMode(mode As Dynamic) As Boolean 

Specifies the looping mode for media playback. This method can also accept one of the following strings:

  • "NoLoop": Looping is disabled in all cases. This is the default behavior, allowing for playback of multiple files in a playlist—with noticeable gaps between the end and beginning of the file.

  • "AlwaysLoop": The video is looped seamlessly if possible; otherwise, it is looped with seams.

  • "SeamlessLoopOrNotAtAll": The video is looped seamlessly if possible; otherwise, it is not looped at all.

  • "LoopButNotSeamless": The video is looped with seams.

Alternatively, this method can accept a Boolean argument: 

  • true: A single media file will loop seamlessly if possible. If the video file cannot be looped seamlessly, then the video will loop with seams. 

  • false: Looping is disabled in all cases. This is the default behavior, allowing for playback of multiple files in a playlist—with noticeable gaps between the end and beginning of the file.

 

AddEvent(user_data As Integer, time_in_ms As Integer) As Boolean

Adds a trigger that will generate an roVideoEvent when it reaches the specified time. The user data will be passed with the event and can be retrieved using the roVideoEvent.GetData() method. See the Video Timecode Events section below for more details.

ClearEvents() As Boolean

Removes all timecode events that have been added using the AddEvent() method.

GetEvents() As roArray

Returns an array of timecode events added to the roVideoPlayer instance using the AddEvent() method. Each entry in the array consists of an associative array with the following values:

  • id: The user_data of the event (as an Integer)

  • timestamp: The timestamp (in milliseconds)

PlayEx(a As Object) As Boolean

This object has been deprecated. We suggest using the PlayFile() method for video playback instead.

GetPlaybackPosition() As Integer

Returns the amount of time the current file or IP stream has been playing (in milliseconds). If SetLoopMode() is set to true, the value will not reset when playback loops. If looping playback or IP streaming continues uninterrupted for approximately 25 days, the value will wrap around and become negative.

GetDuration() As Integer

Returns the total playback duration (in milliseconds) of the current file.

Seek(position As Integer) As Boolean

Seeks to the specified position in the audio/video file(measured in milliseconds). If the file is currently playing, then it will continue to play; otherwise, it will remain paused after seeking. This method only supports the MP4/MOV video container; all standard audio formats are supported.

SetFade(parameters As roAssociativeArray) As Boolean

Fades out both the video and audio when the method is called. When the fade completes, an roVideoEvent object with the 18 – FadeOut  value will be posted to the message port. This method accepts an associative array, which can currently contain only one parameter:

  • FadeOutLength: The length of time (in milliseconds) over which the audio/video fades out.

ProbeFile(filename As String) As roAssociativeArray

Returns an associative array containing metadata about the specified video file. To retrieve metadata about a file that is currently playing, use the GetStreamInfo() method instead. The returned associative array can contain the following parameters:

  • Source: The URI of the file

  • Encapsulation: The encapsulation of the video

  • AudioFormat: The format of the audio file

  • AudioSampleRate: The audio sample rate (in hertz)

  • AudioChannelCount: The number of audio channels

  • AudioDuration: The duration of the audio track (in milliseconds)

  • VideoFormat: The format of the video file

  • VideoColorDepth: The color depth of the video (in bits)

  • VideoWidth: The width of the video (in pixels)

  • VideoHeight: The height of the video (in pixels)

  • VideoAspectRatio: The aspect ratio of the video

  • VideoDuration: The duration of the video (in milliseconds)

ifZorderControl

ToFront() As Boolean 

Places the video layer of the roVideoPlayer instance in front of the other video player.

ToBack() As Boolean

Places the video layer of the roVideoPlayer instance behind the other video player.

ifAudioControl

See the roAudioPlayer entry for documentation of ifAudioControl.

ifAudioAuxControl

MapStereoOutputAux(mapping As Integer) As Boolean
 
SetVolumeAux(a As Integer) As Boolean
 
SetChannelVolumesAux(channel_mask As Integer, b As Integer) As Boolean
 
SetAudioOutputAux(audio_output As Integer) As Boolean
 
SetAudioModeAux(audio_mode As Integer) As Boolean
 
SetAudioStreamAux(stream_index As Integer) As Boolean
 
SetUsbAudioPortAux(a As Integer) As Boolean

ifUserData

SetUserData(user_data As Object)

Sets the user data that will be returned when events are raised.

GetUserData() As Object

Returns the user data that has previously been set via SetUserData(). It will return Invalid if no data has been set.

ifIdentity

GetIdentity() As Integer

ifMessagePort

SetPort(port As roMessagePort)

Posts messages of type roVideoEvent  to the attached message port.

Timecode Events 

You can use the AddEvent() method to add triggers for roVideoEvent events, which will generate the 12 – Timecode Hit value at the specified millisecond times in a video file. Use the roVideoEvent.GetData() method to retrieve the user data passed with AddEvent().

The following example script uses timecode events. The script prints 2, 5, and 10 at 2 seconds, 5 seconds, and 10 seconds into the video, respectively. The "msg" is approaching frame accurate.

v = CreateObject("roVideoPlayer") p = CreateObject("roMessagePort") v.SetPort(p)   ok = v.AddEvent(2, 2000) ' Add timed events to video ok = v.AddEvent(5, 5000) ok = v.AddEvent(10, 10000) ok = v.AddEvent(100, 100000) ok = v.PlayFile("SD:/C5_d5_phil.vob")   waitloop: msg = Wait(0,p) ' Wait for all events if msg.GetInt() = 8 then stop ' End of file if msg.GetInt() <> 12 goto waitloop ' I only care about time events print msg.GetData() ' Print out index when the time event happens goto waitloop

Multiscreen Video Playback 

The PreloadFile() and PlayFile() methods can be used in conjunction with roSyncManager to stretch an image across multiple screens in an array or display windowed portions of a video.

The following example script uses the PreloadFile() method for multiscreen display:

v=CreateObject("roVideoPlayer") a=CreateObject("roAssociativeArray") a["Filename"] = "test.ts" a["MultiscreenWidth"] = 3 a["MultiscreenHeight"] = 2 a["MultiscreenX"] = 0 a["MultiscreenY"] = 0 v.PreloadFile(a) ... ... v.Play()

The MultiscreenWidth and MultiscreenHeight values specify the width and height of the multiple-screen matrix. For example, 3x2 would be 3 screens wide and 2 high. MultiscreenX and MultiscreenY specify the position of the current screen within that matrix. In the case above, on average only 1/6th of the video is drawn on each screen (though the view mode still applies), so depending on the shape of the video, it may have black bars on the side screens. In this way, it is relatively simple for a video player to display part of an image based on its position in the multiscreen array.

PreloadFile() does all of the preliminary work to get ready to play the specified video clip, including stopping the playback of the previous video file. The call to "Play" starts the playback. This is good for synchronizing video across multiple players as they can all be prepared ready to play and then will immediately start playing when the "Play" command is issued. This reduces synchronization latencies.

The following are the default values for the parameters:

  • MultiscreenWidth= 1

  • MultiscreenHeight= 1

  • MultiscreenX= 0

  • MultiscreenY= 0

This script uses PlayFile() to display a portion of a video. This displays a windowed portion of the test.ts video file starting at coordinates SourceX, SourceY, and SourceWidth by SourceHeight in size. The SetViewMode() setting is still honored as if displaying the whole file.

Multiscreen with Portrait Mode

To create a multiple-screen matrix in portrait mode, call SetTransform("rot90") or SetTransform("rot270") before calling PlayFile().

This script creates a 2x1 portrait-mode multiscreen display:

RF Channel Scanning

The PlayFile() method can be used for channel scanning and handling functionality similar to roChannelManager. To use PlayFile() for channel scanning, pass an roAssociativeArray with the following possible parameters:

  • VirtualChannel

  • RfChannel

  • SpectralInversion

    • INVERSION_ON

    • INVERSION_OFF

    • INVERSION_AUTO

  • ModulationType

    • QAM_64

    • QAM_256

    • QAM_AUTO

    • 8VSB

  • VideoCodec

    • MPEG1-Video

    • MPEG2-Video

    • MPEG4Part2-Video

    • H264

    • H264-SVC

    • H264-MVCAVSC

  • AudioCodec

    • MPEG-Audio

    • AAC

    • AAC+

    • AC3AC3+DTS

  • VideoPid

  • AudioPid

  • PcrPid

The VirtualChannel and RfChannel parameters must be present for PlayFile() to scan correctly. If you specify only these parameters, the player will scan the RF channel for a QAM/ATSC signal and attempt to retrieve the specified virtual channel from the results. The results from this action are cached so that subsequent calls to PlayFile() will take much less time. Providing the SpectralInversion and/or ModulationType parameters will further speed up the scanning process.

If all parameters are supplied, then no scanning is required and the player can tune to the channel immediately. If one or more of the optional parameters is missing, then the player must parse the transport stream metadata to find the appropriate values for the supplied VirtualChannel and RfChannel.

Video Decryption 

The roVideoPlayer object can be used to play audio/video files or streams that have been encrypted using AES. 

The associative array passed to the PlayFile() method can accept two parameters for file decryption:

  • EncryptionAlgorithm: The file-encryption algorithm. The following are the current options:

    • "AesCtr": The AES algorithm in CTR mode

    • "AesCtrHmac": The AES algorithm in CTR mode with HMAC

    • "TsAesEcb": The AES algorithm in ECB mode (e.g. with a Harmonic Prostream). This algorithm is used for streaming encryption/decryption.

    • "TsAesCbcRbt": The AES algorithm in CBC mode with residual block termination. This algorithm is used for streaming encryption/decryption.

    • "TsAesCbcCbt": The AES algorithm in CBC mode with clear block termination. This algorithm is used for streaming encryption/decryption.

  • EncryptionKey: A byte array consisting of 128 bits of key. If the encryption algorithm is AES-CTR or AES-CTR-HMAC, this is followed by 128 bits of IV.

 

 

Example

Preferred Streams

If multiple video, audio, or data streams are encapsulated in the video input, you can use the SetPreferredVideo(), SetPreferredAudio(), and SetPreferredCaptions() methods to determine which stream to use. For example, if a video may contain English and Spanish audio tracks, you can call SetPreferredAudio() to specify that the Spanish track should be played if it exists, with the video defaulting to English otherwise.

Preferred streams are chosen by matching the patterns in the passed string(s) against the textual description of the stream:

  1. The passed string is a semicolon-separated list of templates.

  2. Each template is a comma-separated list of patterns.

  3. Each pattern is a [field_name]=[field_value] pair that is matched directly against the stream description.

SetPreferredVideo(description As String) As Boolean

Each template in the passed video description string can contain the following patterns:

  • pid=[integer]: The packet identifier (PID) of the video stream you wish to display

  • program=[integer]: The program number of the video stream

  • codec=[video_codec]: The preferred video codec, which can be any of the following:

    • MPEG1

    • MPEG2

    • MPEG4Part2

    • H263

    • H264

    • VC1

    • H265

  • width=[integer]: The preferred video width

  • height=[integer]: The preferred video height

  • aspect=[float(x.yy)]: The preferred aspect ratio of the video stream as a floating-point number with two fractional digits.

  • colordepth=[integer]: The preferred color depth of the video.
     

Example
SetPreferredAudio(description As String) As Boolean

Each template in the passed description string can contain the following patterns:

  • pid=[integer]: The packet identifier (PID) of the audio stream you wish to play

  • program=[integer]: The program number of the audio stream

  • codec=[audio_codec]: The preferred audio codec, which can be any of the following:

    • MPEG

    • MP3

    • AAC

    • AAC-PLUS

    • AC3

    • AC3-PLUS

    • DTS

    • PCM

    • FLAC

    • Vorbis

  • channels=[integer]: The preferred number of audio channels (from 1 to 8)

  • freq=[frequency]: The preferred sample frequency of the audio track, which can be any of the following:

    • 32000

    • 44100

    • 48000

  • lang=[language]: A code that determines the preferred language of the audio track (e.g. eng, spa). The language codes are specified in the ISO 639-2 standard.

  • type=[audio_type]: The preferred audio type, which can be one of the following:

    • Main audio

    • Clean effects

    • Hearing impaired

    • Visual impaired commentary

Example
SetPreferredCaptions(description As String) As Boolean

Each template in the passed description string can contain the following patterns:

  • pid=[integer]: The packet identifier (PID) of the caption stream you wish to play

  • type=[subtitle_type]: The encoding standard of the subtitles. This value can be one of the following:

    • CEA708: If the CEA-708 standard is not present, the subtitle_type will default to CEA-608 (if it is present).

    • CEA608

    • DVB

  • lang=[language]: A code that determines the preferred language of the subtitles (e.g. eng, spa). The language codes are specified in the ISO 639-2 standard.

  • service=[integer]: The preferred service number of the caption stream
     

Example

Pattern Matching Rules

Note the following rules when matching templates to video, audio, or caption stream descriptions:

  • For a template to match a stream description, every pattern within the template must match.

  • The first listed template to match the stream description (if any) will be used.

  • An empty template string will match any stream description.

  • All value comparisons are case-insensitive.

  • Numerical values must match the stream description exactly (without leading zeroes). For example, the pattern pid=016 will never match the stream PID value of 16.

  • To indicate logical negation, apply the "!" exclamation mark to the beginning of a pattern. For example, specifying SetPreferredVideo("!codec=H265") will match only streams that are not encoded using H.265.

  • Apply the ">" greater-than symbol before an integer to indicate that, for a successful match, the value in the stream description must be greater than the value following the symbol. For example, specifying SetPreferredVideo("width=<1921,height=<1081") will match only videos that are no larger than full-HD.

  • Apply the "<" less-than symbol before an integer to indicate that, for a successful match, the value in the stream description must be less than the value following the symbol.

Pattern Matching Examples

The following examples illustrate some of the pattern matching behavior described above:

  • The following template list contains three patterns: lang=eng, lang=spa, and an empty template. The first pattern specifies an English language channel; if the English channel does not exist, the second pattern specifies a Spanish language channel. The third pattern specifies any other channel if the first two don't exist (the empty template matches anything).

  • Since the following template list is empty, no captions are specified. This can be used to disable captions altogether.

  • The following template list contains an empty template. Since an empty template matches anything, the first video stream encountered will be played. This is the default behavior of all attributes.

  • The following template list specifies a 48KHz audio stream if there is one; otherwise, no audio stream will be played. Observe that the list is not correctly terminated with a semicolon; in this case, the semi-colon is implicitly supplied.

  • The following template list contains two templates. Note that all patterns within a template must match the stream description for the entire template to match. In this example, an AAC-encoded English track is preferred; an MP3-encoded English track is designated as the second option; and any track will be chosen if neither template is matched.

Examples

The following script selects a program from a video and sets preferred video and audio tracks for playback: 

This script enables only HDMI-4 at 3840x2160x60p: