Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Panel
borderColor#3D3D3D
bgColor#F4F4F4
titleColor#3D3D3D
borderWidth0
titleBGColor#3D3D3D
borderStylesolid

ON THIS PAGE

Table of Contents
indent20px

Excerpt Include
BrightScript Version Navigation Menu
BrightScript Version Navigation Menu
nopaneltrue
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.

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

 

ifIdentity

GetIdentity() As Integer

 

ifMessagePort

SetPort(port As roMessagePort) As Void

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.

ifAudioControl

See the roAudioPlayer page for documentation of the ifAudioControl interface.

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

 

ifVideoControl

PlayStaticImage(filename As String) As Boolean

...

  • 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.

Warning
titleImportant

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 
Anchor
setviewmode
setviewmode

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

  • 0"ScaleToFit": Scales the video to fill the window. The aspect ratio of the source video is ignored, so the video may appear stretched/squashed.
  • 1"LetterboxedAndCentered": Letterboxes and centers the window. The aspect ratio of the source window is maintained.
  • 2:(Default) "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.
Note
titleNote

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

...

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 
Anchor
setkeyingvalue
setkeyingvalue

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:

...

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 
Anchor
settransform
settransform

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
Note
titleNote

 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 containing information about an IP stream. The associative array contains 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:

  • Source[string] Source: The source address URI of the IP streamSrcAddressvideo file
  • [string] SrcAddress: The source IP address of the sourceDstAddressvideo 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).
  • encapsulation[string] Encapsulation: The encapsulation of the IP streamvideo. This value can be "ES" (elementary stream), "TS" (transport stream), or "UNKNOWN" for streaming video.
  • AudioFormat[string] AudioFormat: The format of the audio file
  • AudioSampleRate[int] AudioSampleRate: The audio sample rate (in hertz)
  • AudioChannelCount[int] AudioChannelCount: The number of audio channels
  • AudioDuration[int] AudioDuration: The duration of the audio track VideoFormat(in milliseconds)
  • [string] VideoFormat: The format of the video fileVideoColorDepth
  • : The [int] VideoFramerate: The video frame rate (in frames per second)
  • [int] VideoColorDepth: The color depth of the video (in bits)
  • VideoWidth[int] VideoWidth: The width of the video (in pixels)
  • VideoHeight[int] VideoHeight: The height of the video (in pixels)
  • VideoAspectRatio[float] VideoAspectRatio: The aspect ratio of the video
  • VideoDuration[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 (see the example at the bottom of this page for more details). 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 

      Tip
      titleTip

      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 associtaive 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 associtaive 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 associtaive 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

...

Note
titleNote

All counters are reset every time PlayFile() is called. The audio keys will not be included in the associative array if there is no audio in the stream.

  • Bitrate[int] Bitrate: The video bitrate
  • NumDisplayed[int] NumDisplayed: The number of video frames displayed. This is based on the refresh rate of the monitor.
  • NumUnderflowed[int] NumUnderflowed: The number of times the video FIFO has under-flowed. This usually indicates that the the buffer size needs  needs to be increased.
  • NumDecodeErrors[int] NumDecodeErrors: The number of video frames with decode errors
  • NumDecoded[int] NumDecoded: The total number of video frames decoded
  • NumAudioDecoded[int] NumAudioDecoded: The total number of audio frames decoded
  • NumAudioDecodeErrors[int] NumAudioDecodeErrors: The number of audio frames with decode errors
  • NumAudioDummy[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.
  • NumAudioUnderflows[int] NumAudioUnderflows: The number of times the audio FIFO has under-flowed. This usually indicates that the the buffer size needs  needs to be increased.
  • VideoFramesPerSecond[int] VideoFramesPerSecond: The video frame rate (in frames per second)
  • VideoInterlaced[int] VideoInterlaced: A flag indicating whether the video frames are interlaced or progressive
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.

SetMaxResolution(x As Integer, y As Integer) As Boolean

Specifies the maximum resolution that the mosaic decoder will support. This determines the number of mosaic decoders you can successfully create. You can clear this value by passing 0 to this method.

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 
Anchor
playfile
playfile

Plays video using the parameters passed as an associative array. This method has several uses: Playing synchronized (and multiscreen) video using the parameters provided by the roSyncManager object; playing streaming video from an roRtspStream object; playing encrypted files; or playing RF Input using the associative array provided by the CreateChannelDescriptor() method on the roChannelManager object. In addition to the above uses, the associative array can contain the following parameters for audio/video playback: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.).

  • Filename: The name/path of the a file to be used for playback
  • Url: The URL of a video stream to be used for playback
  • 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
  • FadOutLength: The length (in milliseconds) of fade-out at the end of the media
  • Transform: The rotation of the video. See the SetTransform() entry for a list of applicable values.
  • Decoder: The friendly_name of the decoder that you wish to use to play the video.
  • LoopMode: The looping mode for media playback. See the SetLoopMode() entry for a list of applicable values.
  • ViewMode: The view mode of the video window. See the SetViewMode() entry for a list of applicable values.
  • 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.
  • StreamFadeIn: The length (in milliseconds) of audio/video fade-in for streams.
  • 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.
  • StreamProbe: The stream probe type. This parameter can be set to "deep" (to include video dimensions, audio sample rate, etc.) or "shallow".
  • StreamMaxBitrate: The maximum initial bitrate (in bytes) for adaptive streaming.


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

  • LumaKey
  • CrKey
  • CbKey


These parameters are used to play encrypted video:

  • EncryptionAlgorithm
  • EncryptionKey
     

These parameters are used to parse preferred streams:

  • PreferredVideo
  • PreferredAudio
  • PreferredCaptions
     

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

  • SyncDomain
  • SyncId
  • SyncIsoTimestamp


These parameters are used for multiscreen playback:

  • MultiscreenWidth
  • MultiscreenHeight
  • MultiscreenX
  • MultiscreenY
  • SourceX
  • SourceY
  • SourceWidth
  • SourceHeight
SetProperties(parameters As roAssociativeArray) As Boolean 
Anchor
setproperties
setproperties

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.

Code Block
titleExample
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

...

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 
Anchor
stopclear()
stopclear()

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 master unit and the roSyncManagerEvent.GetIsoTimeStamp() method on slave 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 master unit and the roSyncManagerEvent.GetIsoTimeStamp() method on slave unit(s). 
SetLoopMode(mode As Dynamic) As

...

Boolean 
Anchor
setloopmode
setloopmode

Specifies the looping mode for media playback. If this method is passed True, a single media file will loop seamlessly. Setting this method to False, which  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 an associative array with the following parameters:

...

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.
Note
titleNote

Media End events are only sent if seamless looping is disabled, or if enable_ if _seamless is enabled and the the mode is set to "SeamlessLoopOrNotAtAll" and the file cannot be looped seamlessly.

...

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.

...

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

GetEvents() As roArray

Returns an array of timecode events added to the roVideoPlayer instance using the AddEvent() method 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)
StopClear() As Boolean
 
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 master unit and the roSyncManagerEvent.GetIsoTimeStamp() method on slave 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 master unit and the roSyncManagerEvent.GetIsoTimeStamp() method on slave unit(s).
PlayEx(a As Object) As Boolean

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

...

Returns the amount of time the current file or IP stream has been playing (in milliseconds). If SetLoopMode() is  is set to True 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.

...

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:

...

Returns an associative array containing metadata about the specified media 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

...

Note
titleNote

This feature is not available on HD/LS players, which only support a single video player. For more information on ordering video layers relative to the graphics layer, refer to the roVideoMode.SetGraphicsZOrder() entry.

Timecode Events

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
Note
titleNote

The ifIdentity interface has been deprecated. We recommend using the ifUserData interface instead.

ifMessagePort

SetPort(port As roMessagePort)

Posts messages of type roVideoEvent  to the attached message port.

Timecode Events 
Anchor
timecode_events
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.

 

Code Block

...

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 
Anchor
multiscreen_video_playback
multiscreen_video_playback

The PreloadFile() and PlayFile() functions. These take an roAssociativeArray, rather than a string, as a parameter. These alternative methods are  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, though they can also be used in place of the original function calls for standard operations.

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

 

Code Block
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.

...

Code Block
v=CreateObject("roVideoPlayer")
a=CreateObject("roAssociativeArray")
a["Filename"] = "test.ts"
a["SourceX"] = 100
a["SourceY"] = 100
a["SourceWidth"] = 1000
a["SourceHeight"] = 500
v.PlayFile(a)

...

Multiscreen with Portrait Mode

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

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

Code Block
vv1=CreateObject("roVideoPlayer")
av1.SetViewMode("LetterboxedAndCentered")
r=CreateObject("roAssociativeArray")
a["Filename"] = "test.ts"
a["MultiscreenWidth"] = 3
a["MultiscreenHeight"]roRectangle", 0, 0, 1920, 1080)
v1.SetRectangle(r)
v1.SetTransform("rot90")

aa1=CreateObject("roAssociativeArray")
aa1.MultiscreenWidth = 2
aa1.MultiscreenHeight = 1
a["MultiscreenX"]aa1.MultiscreenX = 0
a["MultiscreenY"]1
aa1.MultiscreenY = 0
v.PreloadFile(a)
v.SetViewMode(0)

v.Play(aa1.Filename = "example.mp4"
v1.PlayFile(aa1)

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:

...

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.

Playing Encrypted Files

...

Video Decryption 
Anchor
playing_encrypted_files
playing_encrypted_files

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

Note
titleNote

Streaming decryption requires firmware version 6.2.x and is currently only supported with the UDP protocol and the HTTP protocol (when HTTP is paired with an MPEG2 transport stream). If using a UDP multicast MPEG2 transport stream, one of the elemental streams should provide the PCR to the player.

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

  • EncryptionAlgorithm: The file-encryption algorithm. Currently The following are the current options are :
    • "AesCtr"
    and
    • : 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.
  • 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.

 

Note
titleNote

File decryption is only supported on the 4Kx42, XDx32, XDx30, and HDx22 platformsContact support@brightsign.biz to learn more about generating a key for obfuscation and storing it on the player.


Warning
titleImportant

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).


Code Block
titleExample
v = CreateObject("roVideoPlayer")
aa=CreateObject("roAssociativeArray")
aa.filename = "wall-sync2.mp4"
aa.encryptionalgorithm = "AesCtr"
aa.encryptionkey = CreateObject("roByteArray")
aa.encryptionkey.fromhexstring("01030507090b0d0f00020406080a0c0e00000000000000000000000000000000")


v.PlayFile(aa)

Preferred Streams
Anchor
preferred_streams
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.

...

  • 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.
         

      ...

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

      • pid=[integer]: The packer 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
        • 480048000
      • lang=[language]: A  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

       


      Code Block
      titleExample
      "pid=4192, codec=AC3, channels=5, freq=48000, lang=eng, type=Main audio;;"

      ...

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

      • pid=[integer]: The packer 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
         
      Code Block
      titleExample
      "pid=0, type=Cea708, lang=eng service=1;;"

      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, and all integer values must have no leading zeroes.
      • 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:

      ...

      Code Block
      SetPreferredAudio("codec=aac,lang=eng;codec=mp3,lang=eng;;")

       

       

      Examples

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

      Anchor
      example_program_select
      example_program_select

      Code Block
      v1 = CreateObject("roVideoPlayer")
      v1.PlayFile("example.ts")
      si = v1.GetStreamInfo()
      
      
      ' Pick the program
      prog = si.Programs[2].ProgramId
      v1 = CreateObject("roVideoPlayer")
      
      ' Select the program
      v1.SetPreferredVideo("prog=" + prog.ToStr() + ";")
      v1.SetPreferredAudio("prog=" + prog.ToStr() + ";")
      
      ' Play the stream/file
      v1.PlayFile("example.ts")