Player APIs (BrightScript & Ja...
...
Object Reference
Presentation and Widget Object...
roVideoPlayer
47min
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 html video docid\ e6ujleh69q0jmmv8kytrp 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 roimageplayer docid 0umxqyvruy7drnluuzafp for details on displaying encrypted images 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 source string string the uri of the video file srcaddress string string the source ip address of the video stream dstaddress string string 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 string the encapsulation of the video this value can be "es" (elementary stream), "ts" (transport stream), or "unknown" for streaming video audioformat string string the format of the audio file audiosamplerate int int the audio sample rate (in hertz) audiochannelcount int int the number of audio channels audioduration int int the duration of the audio track (in milliseconds) videoformat string string the format of the video file videoframerate int int the video frame rate (in frames per second) videocolordepth int int the color depth of the video (in bits) videowidth int int the width of the video (in pixels) videoheight int int the height of the video (in pixels) videoaspectratio float float the aspect ratio of the video videoduration int int the duration of the video (in milliseconds) preferredvideo int int the current preferred video track, as determined by the setpreferredvideo() method preferredaudio int int the current preferred audio track, as determined by the setpreferredaudio() method preferredsubtitle int int the current preferred subtitle track, as determend by the setpreferredcaptions() method programs roarray roarray 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 video , audio , and subtitle parameters and the setpreferred<>() methods to scan and select tracks each entry can contain the following parameters programid int int the program id video roarray roarray an index of integers corresponding to video tracks that are part of the program audio roarray roarray an index of integers corresponding to audio tracks that are part of the program subtitle roarray roarray 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]] ) video roarray roarray a list of video tracks that are part of the video each entry in the list is an associative array with the following parameters aspectratio float float the aspect ratio of the video track name string string the name of the video track width int int the video width (in pixels) height int int the video height (in pixels) colordepth int int the aspect ratio of the video track duration int int the duration of the video track (in milliseconds) program int int the id of the program to which the video track belongs framerate float float the framerate of the video track pid int int the packet identifier (pid) of the video track format string string the format of the video track audio roarray roarray a list of audio tracks that are part of the video each entry in the list is an assocative array with the following parameters name string string the name of the audio track channelcount int int the number of audio channels format string string the format of the audio track pid int int the packet identifier (pid) of the audio track program int int the id of the program to which the audio track belongs duration int int the duration of the audio track (in milliseconds) samplerate int int the audio sample rate (in hertz) language string string a code specifying the language of the audio track (e g "eng", "spa") the language codes are specified in the iso 639 2 standard subtitle roarray roarray a list of subtitle tracks that are part of the video each entry in the list is an assocative array with the following parameters language string string a code specifying the language of the subtitle track (e g "eng", "spa") the language codes are specified in the iso 639 2 standard program int int the id of the program to which the subtitle track belongs pid int int the packet identifier (pid) of the subtitle track type string string 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 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 int the video bitrate numdisplayed int int the number of video frames displayed this is based on the refresh rate of the monitor numunderflowed int int the number of times the video fifo has under flowed this usually indicates that the customize network streaming docid 0tioy9pjdgg4g25ygbnib needs to be increased numdecodeerrors int int the number of video frames with decode errors numdecoded int int the total number of video frames decoded numaudiodecoded int int the total number of audio frames decoded numaudiodecodeerrors int int the number of audio frames with decode errors numaudiodummy int int 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 int the number of times the audio fifo has under flowed this usually indicates that the customize network streaming docid 0tioy9pjdgg4g25ygbnib needs to be increased videoframespersecond int int the video frame rate (in frames per second) videointerlaced int int indicates whether the video frames are interlaced or progressive hardwaredecode bool bool 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 note that getstreamstatistics() only returns valid data after the playing event has been sent to a script 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 rovideomode docid\ qq734nqz0hcwni0unsdmp to use encryptionalgorithm the encryption algorithm to use for rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn encryptionkey the encryption key to use for rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 html video docid\ e6ujleh69q0jmmv8kytrp 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 the 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 rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn entry for more details) cbkey crkey lumakey these parameters are used to rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn encryptionalgorithm encryptionkey these parameters are used to parse rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn preferredaudio preferredcaptions preferredvideo these parameters are used in conjunction with the rosyncmanager docid\ wwc22zsphu1e689xe7en6 object to synchronize playback syncdomain syncid syncisotimestamp these parameters are used for rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn entry for a list of available parameters getproperties() as roassociativearray returns the current video playback properties as an associative array see the rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 media end events are only sent if seamless looping is disabled, or if the mode is set to "seamlessloopornotatall" and the file cannot be looped seamlessly 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 rovideoplayer docid\ ztuz0ldazcml2kqmdbkcn 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 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 ifaudiocontrol see roaudioplayer docid\ kcsshyuyynrahpnnfnb 9 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 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 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 example 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 example 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 example 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 settransform("rot90") or settransform("rot270") before calling playfile() this script creates a 2x1 portrait mode multiscreen display example v1=createobject("rovideoplayer") v1 setviewmode("letterboxedandcentered") r=createobject("rorectangle", 0, 0, 1920, 1080) v1 setrectangle(r) v1 settransform("rot90") aa1=createobject("roassociativearray") aa1 multiscreenwidth = 2 aa1 multiscreenheight = 1 aa1 multiscreenx = 1 aa1 multiscreeny = 0 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 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 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 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 contact support\@brightsign biz to learn more about generating a key for obfuscation and storing it on the player 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) example 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 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 the passed string is a semicolon separated list of templates each template is a comma separated list of patterns 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 "pid=7680, codec=h264, width=1280, height=720, aspect=1 78, colordepth=8;" 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 "pid=4192, codec=ac3, channels=5, freq=48000, lang=eng, type=main audio;" 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 "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 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) setpreferredaudio("lang=eng;lang=spa;;") since the following template list is empty, no captions are specified this can be used to disable captions altogether setpreferredcaptions("") 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 setpreferredvideo(";") 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 setpreferredaudio("freq=48000") 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 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 example 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") this script enables only hdmi 4 at 3840x2160x60p example mode=createobject("rovideomode") sm = createobject("roarray", 1, 1) sm\[0] = createobject("roassociativearray") sm\[0] name = "hdmi 4" sm\[0] video mode="3840x2160x60p" sm\[0] transform="normal" sm\[0] display x=0 sm\[0] display y=0 sm\[0] enabled=true mode setscreenmodes(sm) ' play full screen video with audio going to hdmi 4 rect = createobject("rorectangle",0,0,3840,2160) output = createobject("roaudiooutput", "hdmi 4") vplayer = createobject("rovideoplayer") vplayer setrectangle(rect) vplayer setcompressedaudiooutputs(output) vplayer playfile("example mp4")