Video
Extends Group
The Video node class provides a controlled play of live or VOD video.
The Video node includes a wide variety of internal nodes to support trick play, playback buffering indicators, and so forth. Playback buffering indicators, to indicate buffering before initial playback as well as re-buffering, use an internal instance of a ProgressBar node. For trick play, an internal instance of a TrickPlayBar node is provided. For display of BIF images for DVD-like chapter selection, an internal instance of a BIFDisplay node is provided.
Starting from Roku OS 8, the behavior of the Roku system overlay is such that the system overlay now slides in whenever the * button is pressed, the Video node is in focus, and the app does not have its OnKeyEvent() handler fired. When the Video node is not in focus, the system overlay does not slide in and the OnKeyEvent() handler is fired.
Fields
Playback fields
To set the specific video playback parameters for a particular video, set the Content Meta-Data attributes for the video in a ContentNode node, and assign the ContentNode to the content field of the Video node.
Video playback can then be controlled by setting the value of the control field, such as setting the field value to play to begin playback.
The control field includes a prebuffer option, which allows the video to begin buffering without showing the video. You can use this option to begin buffering of a video before a user has actually selected and started the video, such as when the user is looking at information about various video offerings in a list or grid or another type of UI element. This can eliminate much or all of the apparent delay in starting the video due to buffering the video for the user. For example, you could set the control field value to prebuffer in a callback function triggered by the itemFocused events that occur as a user scrolls down a list of video offerings that also display information about each video. When the user makes the selection, you can begin the actual video playback by setting the control field value to play in a callback function triggered by the itemSelected event for the list.
| Field | Type | Default | Access Permission | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| content | ContentNode | NULL | READ_WRITE | The ContentNode with the Content Meta-Data for the video, or a video playlist (a sequence of videos) to be played. If a video playlist is to be played, the children of this ContentNode comprise the playlist, and each ContentNode child must have all attributes required to play that video. For example, if the videos "A" and "B" are to be played, three ContentNodes must be created: the parent ContentNode (which is largely ignored), one ContentNode child for "A," and one ContentNode child for "B." The parent node is set into this content field, and when video playback is started, all of its children will be played in sequence. Any changes made to the playlist after playback has started are ignored. See the contentIsPlaylist and contentIndex fields, for more information on playlists. | ||||||||||||||||||||||||||||||||||||||||
| playStartInfo | roAssociativeArray | READ_ONLY | Provides timing measurements related to the start of video playback. All measurements are in seconds. The roAssociativeArray contains the following fields:
| |||||||||||||||||||||||||||||||||||||||||
| licenseStatus | roAssociativeArray | READ_ONL | Indicates whether the DRM license was acquired. If a failure occurs, this field provides additional details about the error. The roAssociativeArray contains the following fields:
| |||||||||||||||||||||||||||||||||||||||||
| contentIsPlaylist | Boolean | false | READ_WRITE | If set to true, enables video playlists (a sequence of videos to be played). See the content and contentIndex field for more information on playlists. | ||||||||||||||||||||||||||||||||||||||||
| contentIndex | integer | -1 | READ_ONLY | The index of the video in the video playlist that is currently playing. Generally, you would only want to check this field if video playlists are enabled (by setting the contentIsPlaylist field to true), but it is set to 0 when a single video is playing, and video playlists are not enabled. | ||||||||||||||||||||||||||||||||||||||||
| nextContentIndex | integer | -1 | READ_WRITE | If the contentIsPlaylist field is set to true to enable video playlists, sets the index of the next video in the playlist to be played. Setting this field does not immediately change the video being played, but takes effect when the current video is completed or skipped. By default, this value is -1, which performs the default index increment operation. After the video specified by the index in this field begins playing, the field is set to the default -1 again, so the next video played will be set by the default index increment operation unless the field is set again to a different index. | ||||||||||||||||||||||||||||||||||||||||
| control | option string | none | READ_WRITE | Sets the desired play state for the video, such as starting or stopping the video play. Getting the value of this field returns the most recent value set, or none if no value has been set. To dynamically monitor the actual state of the video, see the state field.The play and stop commands to commence and discontinue playback should not be used to implement trick modes like rewind, or replay. For that use the seek field.
| ||||||||||||||||||||||||||||||||||||||||
| asyncStopSemantics Available since Roku OS 12.5 | boolean | false | WRITE | Indicates whether the "STOP" command is executed asynchronously (true) or synchronously (false). By default, the STOP command is executed synchronously, which blocks the UI thread. Enabling this field makes the STOP command non-blocking, which enables the video to be switched faster. When this field is enabled, the state field is set to "stopping" when the asynnchronous stop begins. The state field then changes to "stopped" once the stop has been completed.Any other media player component calls on the UI thread that require the Video node to be re-instantiated should be blocked until the asynnchronous stop has been completed (for example, updating the control field to "Play" or "Prebuffer" or updating the seek field). This is because a video node in the "stopping" state is still using the underlying media player, which is not available at that time. As a result, performing these types of operations on a different video while in the "stopping" state may result in a playback failure. | ||||||||||||||||||||||||||||||||||||||||
| state | value string | none | READ_ONLY | Describes the current video play state, such as if the video play has been paused.
| ||||||||||||||||||||||||||||||||||||||||
| errorCode | integer | 0 | READ_ONLY | The error code associated with the video play error set in the state field: Use the errorStr and and errorInfo fields for more descriptive diagnostic information to help identify and resolve the cause of the error. | ||||||||||||||||||||||||||||||||||||||||
| errorMsg | string | READ_ONLY | An error message describing the video play error set in the state field.Use the errorStr and and errorInfo fields for more descriptive diagnostic information to help identify and resolve the cause of the error. | |||||||||||||||||||||||||||||||||||||||||
| errorStr | string | READ_ONLY | A diagnostic message to help resolve the video play error set in the state field.The format of the errorStr is as follows:
| |||||||||||||||||||||||||||||||||||||||||
| errorInfo | roAssociativeArray | READ_ONLY | A diagnostic message to help resolve the video play error set in the state field.The roAssociativeArray contains the following fields:
| |||||||||||||||||||||||||||||||||||||||||
| decoderStats | roAssociativeArray | READ_ONLY | Provides video decoder statistics related to playback. | |||||||||||||||||||||||||||||||||||||||||
| enableDecoderStats | boolean | false | READ_WRITE | Enables updates to the decoderStats field. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtons | roArray of roAssociativeArrays | [] | READ_WRITE | Component that shows the buttons and other specified UI elements on the pause screen at the start of playback. Each element in the array has following fields:
| ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonSelected | integer | 0 | READ_WRITE | The index of the button that is selected in the playbackActionButtons field. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonFocused | integer | 0 | READ_WRITE | The index of the button that has focus in the playbackActionButtons field. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonFocusedTextFont | Font | SmallBoldSystemFont | WRITE | Specifies the font of the button label when the button has key focus. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonUnfocusedTextFont | Font | SmallSystemFont | WRITE | Specifies the font of the button label when the button does not have key focus. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonFocusedTextColor | Color | OX121212FF | WRITE | Specifies the color of the button label text when the button has key focus. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonUnfocusedTextColor | Color | 0xEFEFEFFF | WRITE | Specifies the color of the button label text when the button does not have key focus. | ||||||||||||||||||||||||||||||||||||||||
| playbackActionButtonFocusIndicatorBlendColor | Color | - | WRITE | Specifies the button background color when the button has key focus. | ||||||||||||||||||||||||||||||||||||||||
| subtitleSelectionPreferences (Available since Roku OS 12.5) | oAssociativeArray | { } | WRITE_ONLY | The significance and priority order of the attributes and values for the subtitle tracks available in the video stream. Provide the attribute fields from highest to lowest significance (for example, if language should take precedence over all other attributes, list it first). For the subtitle track languages, provide the language codes from highest to lowest priority (for example, if Spanish for Latin America and the Caribbean ["es-419"] has precedence over Spanish ["es"], list the language codes in the following order: ["es-419", "es"].
Example Explanation The subititle language with the highest priority is "es" with a country code of "419". The next highest priority language is "es" with no country code, and then "es" with any country code. | ||||||||||||||||||||||||||||||||||||||||
| audioSelectionPreferences (Available since Roku OS 12.5) | roAssociativeArray | { } | WRITE_ONLY | The significance and priority order of the attributes and values for the audio tracks available in the video stream.
Provide the attribute fields from highest to lowest significance (for example, if the language should take precedence over the description, list language first. For the audio track languages, provide the language code values from highest to lowest priority (for example, if English for the United States ["en-US"] has precedence over English for the United Kingdom ["en-UK"], list the language codes in the following order: ["en-US", "en-UK"].
Example Explanation The audio language with the highest priority is "en-US". The next highest priority language is "en-UK", then "en" with no country code, and finally "en" with any country code. |
Trickplay fields
| Field | Type | Default | Access Permission | Description | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| duration | time | 0 | READ_ONLY | The duration of the video being played, specified in seconds. This becomes valid when playback begins and may change if the video is dynamic content, such as a live event. | ||||||||||||||||||||||||||||||||||||||||||
| loop | Boolean | false | READ_WRITE | If set to true, the video or video playlist (if the contentIsPlaylist field is set to true to enable video playlists) will be restarted from the beginning after the end is reached. | ||||||||||||||||||||||||||||||||||||||||||
| position | time | invalid | READ_ONLY | Time of the current position in the stream. Either UTC time or elapsed since start of stream depending on content type. As of Roku OS 9.3, when the video is paused, the position is recorded for that pause event. This means that playing, pausing, and resuming a video generates three separate positions. | ||||||||||||||||||||||||||||||||||||||||||
| positionInfo | roAssociativeArray | invalid | READ_ONLY | Contains the following fields that provide information about the last rendered video and audio samples.
| ||||||||||||||||||||||||||||||||||||||||||
| clipId | integer | 0 | READ_ONLY | The clip ID of the currently playing track. | ||||||||||||||||||||||||||||||||||||||||||
| notificationInterval | time | 0.5 | READ_WRITE | The interval between notifications to observers of the position field, specified as the number of seconds. If the value is 0, no notifications are delivered. This value may be read or modified at any time. | ||||||||||||||||||||||||||||||||||||||||||
| seek | time | invalid | WRITE_ONLY | Sets the current position in the video. The value is the number seconds from the beginning of the stream, specified as a double. | ||||||||||||||||||||||||||||||||||||||||||
| seekMode | string | "default" | READ_WRITE | Determines the desired level of accuracy for seek behavior:
| ||||||||||||||||||||||||||||||||||||||||||
| autoplayAfterSeek | boolean | true | READ_WRITE | Enables video content to automatically play after rebuffering. Setting this flag to false disables this default behavior. | ||||||||||||||||||||||||||||||||||||||||||
| timedMetaData | associative array | { } | READ_ONLY | The most recent timed meta data that has been decoded from the video stream. Only meta data with a key that matches an entry in timedMetaDataSelectionKeys will be set into this field. The value of this field is an associative array which contains arbitrary keys and values, as found in the video stream. | ||||||||||||||||||||||||||||||||||||||||||
| timedMetaData2 | associative array | { } | READ_ONLY | This field contains all the same information included in the timedMetaData field and the following additional fields:
| ||||||||||||||||||||||||||||||||||||||||||
| timedMetaDataSelectionKeys | array of strings | [ ] | READ_WRITE | If the video stream contains timed meta data such as ID3 tags, any meta data with a key matching an entry in this array is set into the timedMetaData field. For EMSG data, if any entry in this array is "*", then all timed meta data is selected. HLS tags must be defined separately. | ||||||||||||||||||||||||||||||||||||||||||
| streamInfo | associative array | invalid | READ_ONLY | Information about the video stream that is currently playing or buffering.
| ||||||||||||||||||||||||||||||||||||||||||
| completedStreamInfo | associative array | invalid | READ_ONLY | Information about the video stream that most recently completed playing, due to an error, user action, or end of the stream. The associative array consists of the same keys as for the streaminfo field, with one additional key, isFullResult, a Boolean type that, if true indicates the stream played to completion, or if false, was interrupted by an error or user action. This field is set prior to the state field being changed, so state field observer callback functions can assume that the associative array values are valid when the state field changes. | ||||||||||||||||||||||||||||||||||||||||||
| timeToStartStreaming | time | 0 | READ_ONLY | The time in seconds from playback being started until the video actually began playing. The minimum valid value is 1 millisecond, and this is only valid if the current value of the state field is playing. When the state field value is not playing, the value will be 0. This field is updated prior to the state field changing, so state field observer callback functions can assume this field is valid after the state field value changes to playing. | ||||||||||||||||||||||||||||||||||||||||||
| bufferingStatus | associative array | invalid | READ_ONLY | Contains information about stream buffering progress and status. This field is valid only while buffering is in progress, both at stream startup or when re-buffering is required. Observers will be notified when any element of the array changes, and also when buffering is complete and the field itself becomes invalid. The array contains the following name - value pairs.
| ||||||||||||||||||||||||||||||||||||||||||
| videoFormat | string | READ_ONLY | Contains the format of the currently playing video stream.
| |||||||||||||||||||||||||||||||||||||||||||
| pauseBufferStart | time | 0 | READ_ONLY | The beginning position of the video buffered when paused. This field is only valid for live video. | ||||||||||||||||||||||||||||||||||||||||||
| pauseBufferEnd | time | 0 | READ_ONLY | The ending position of the video buffered when paused. This field is only valid for live video. | ||||||||||||||||||||||||||||||||||||||||||
| pauseBufferPosition | time | 0 | READ_ONLY | The current presentation position of the video buffered when paused. This field is only valid for live video. | ||||||||||||||||||||||||||||||||||||||||||
| pauseBufferOverflow | Boolean | false | READ_ONLY | Indicates that the video buffer was not able to save all video since being paused. This field is only valid for live video. | ||||||||||||||||||||||||||||||||||||||||||
| pauseBufferEpochOffset | double | invalid | READ_ONLY | Enables apps to translate the relative time provided in the pauseBuffer fields to UTC time based on the wall-clock timing provided in live manifests/playlists. | ||||||||||||||||||||||||||||||||||||||||||
| streamingSegment | associative array | { } | READ_ONLY | Information about the video segment that is currently streaming. This is only meaningful for segmented video transports, such as DASH and HLS. The associative array has the following entries:
| ||||||||||||||||||||||||||||||||||||||||||
| downloadedSegment | associative array | invalid | READ_ONLY | Information about the video segment that was just downloaded. This is only meaningful for segmented video transports, such as DASH and HLS. The associative array has the following entries:
| ||||||||||||||||||||||||||||||||||||||||||
| enableLiveAvailabilityWindow | Boolean | False | READ_WRITE | Enables the scrubbing of the trickplay bar during the availability window of live linear streams. | ||||||||||||||||||||||||||||||||||||||||||
| enableThumbnailTilesDuringLive | Boolean | False | READ_WRITE | Enables the thumbnailTiles field to be set and updated in the case of live HLS and DASH streams, which contain thumbnails as the thumbnails become available. By default and when this is set to false, the thumbnailTiles field is not written during live streams to maintain backwards compatibility with older applications and to avoid performance or memory issues. This is becuase they might not be expecting constant updates to the thumbnailTiles field if they were written to handle VOD streams, which rarely update the thumbnailTiles field. | ||||||||||||||||||||||||||||||||||||||||||
| thumbnailTiles | roAssociativeArray | [] | READ_WRITE | Contains the information about HLS and DASH standard thumbnail tiles as they are discovered within the manifest for streams which contain them. This field was first introduced (for VOD only) starting in Roku OS 9.1. Starting with Roku OS 11.0, the app can enable this field for HLS and DASH live streams containing standard thumbnails by setting enableThumbnailTilesDuringLive to true.
The tile_id field is a unique string identifier for the tile_set, which is an associative array containing the attributes of the tile set as well as information about the thumbnails. The tile_set field contains the following fields:
| ||||||||||||||||||||||||||||||||||||||||||
| trickPlayBackgroundOverlay | uri | "" | WRITE | The background overlay to be displayed whenever the playback UI is visible during the video playback experience. |
UI fields
| Field | Type | Default | Access Permission | Description | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| width | float | 0.0 | READ_WRITE | Sets the width of the video play window in pixels. If set to 0.0 (the default), the video play window is set to the width of the entire display screen. | ||||||||||||||||||||||||||||||||||||||||
| height | float | 0.0 | READ_WRITE | Sets the height of the video play window in pixels. If set to 0.0 (the default), the video play window is set to the height of the entire display screen. | ||||||||||||||||||||||||||||||||||||||||
| enableUI | Boolean | true | READ_WRITE | If set to true (the default), the entire Video node user interface (such as ProgressBar and TrickPlayBar nodes, and BIF navigation) appear in response to stream events and remote control key presses. If set to false, most of the Video node user interface will not be shown, and the application is expected to implement the UI. The one exception is the closed-caption dialog, which always appears when the video is playing fullscreen (either full height or full width) and the user presses the Options (*) button. When using the Roku Advertising Framework (RAF), the RAF library may temporarily set this field to false while playing ads. | ||||||||||||||||||||||||||||||||||||||||
| enableTrickPlay | Boolean | true | READ_WRITE | Controls whether trickplay is allowed during playback. When set to false the user trickplay buttons on the remote will have no effect. This only applies when enableUI is set to true. | ||||||||||||||||||||||||||||||||||||||||
| bifDisplay | BifDisplay node | internal instance default | READ_WRITE | Component that displays BIFs and allows navigation. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| trickPlayBar | TrickPlayBar node | internal instance default | READ_WRITE | The visible TrickPlayBar node. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| bufferingBar | ProgressBar node | internal instance default | READ_WRITE | Component that shows the progress of re-buffering, after video playback has started. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| bufferingTextColor | color | system default | READ_WRITE | The color of the text displayed near the buffering bar defined by the bufferingBar field, when the buffering bar is visible. If this is 0, the system default color is used. To set a custom color, set this field to a value other than 0x0. | ||||||||||||||||||||||||||||||||||||||||
| retrievingBar | ProgressBar node | internal instance default | READ_WRITE | Component that shows the progress of initial retrieving of the video, prior to starting playback. The fields of this internal node are the same as for the bufferingBar field, which are the fields of the internal ProgressBar node. | ||||||||||||||||||||||||||||||||||||||||
| retrievingTextColor | color | system default | READ_WRITE | The color of the text displayed near the retrieving bar, when the retrieving bar defined in the retrievingBar field is visible. If this is 0, the system default color is used. To set a custom color, set this field to a value other than 0x0. | ||||||||||||||||||||||||||||||||||||||||
| pivotNode | renderable node | - | READ_WRITE | The visible pivot node. This is a generic renderable node that can be used to display any component. This node is only displayed when video is paused. | ||||||||||||||||||||||||||||||||||||||||
| Field | Type | Default | Access Permission | Description | ||||||||||||||||||||||||||||||||||||||||
| width | float | 0.0 | READ_WRITE | Sets the width of the video play window in pixels. If set to 0.0 (the default), the video play window is set to the width of the entire display screen. | ||||||||||||||||||||||||||||||||||||||||
| height | float | 0.0 | READ_WRITE | Sets the height of the video play window in pixels. If set to 0.0 (the default), the video play window is set to the height of the entire display screen. | ||||||||||||||||||||||||||||||||||||||||
| enableUI | Boolean | true | READ_WRITE | If set to true (the default), the entire Video node user interface (such as ProgressBar and TrickPlayBar nodes, and BIF navigation) appear in response to stream events and remote control key presses. If set to false, most of the Video node user interface will not be shown, and the application is expected to implement the UI. The one exception is the closed-caption dialog, which always appears when the video is playing fullscreen (either full height or full width) and the user presses the Options (*) button. When using the Roku Advertising Framework (RAF), the RAF library may temporarily set this field to false while playing ads. | ||||||||||||||||||||||||||||||||||||||||
| enableTrickPlay | Boolean | true | READ_WRITE | Controls whether trickplay is allowed during playback. When set to false the user trickplay buttons on the remote will have no effect. This only applies when enableUI is set to true. | ||||||||||||||||||||||||||||||||||||||||
| bifDisplay | BifDisplay node | internal instance default | READ_WRITE | Component that displays BIFs and allows navigation. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| trickPlayBar | TrickPlayBar node | internal instance default | READ_WRITE | The visible TrickPlayBar node. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| bufferingBar | ProgressBar node | internal instance default | READ_WRITE | Component that shows the progress of re-buffering, after video playback has started. The fields of this internal node are as follows:
| ||||||||||||||||||||||||||||||||||||||||
| bufferingTextColor | color | system default | READ_WRITE | The color of the text displayed near the buffering bar defined by the bufferingBar field, when the buffering bar is visible. If this is 0, the system default color is used. To set a custom color, set this field to a value other than 0x0. | ||||||||||||||||||||||||||||||||||||||||
| retrievingBar | ProgressBar node | internal instance default | READ_WRITE | Component that shows the progress of initial retrieving of the video, prior to starting playback. The fields of this internal node are the same as for the bufferingBar field, which are the fields of the internal ProgressBar node. | ||||||||||||||||||||||||||||||||||||||||
| retrievingTextColor | color | system default | READ_WRITE | The color of the text displayed near the retrieving bar, when the retrieving bar defined in the retrievingBar field is visible. If this is 0, the system default color is used. To set a custom color, set this field to a value other than 0x0. | ||||||||||||||||||||||||||||||||||||||||
| pivotNode | renderable node | - | READ_WRITE | The visible pivot node. This is a generic renderable node that can be used to display any component. This node is only displayed when video is paused. |
Closed caption fields
| Field | Type | Default | Access Permission | Description | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| globalCaptionMode | option string | Off | READ_WRITE | Sets the value of the global Roku closed-caption mode. This can be used to allow the user or the application to change the closed-caption mode in an application just before or during video playback. The possible options are:
The app should set the subtitleTrack field regardless of the selected Caption Mode. | |||||||||||||||||||||
| suppressCaptions | boolean | false | READ_WRITE | Suppresses the closed caption for the purpose of resolving conflicts in cases where UI elements are drawn. Note that most of the disabling/enabling of the captions are done by the Roku OS, including enabling closed caption for Instant Replay. | |||||||||||||||||||||
| subtitleTrack | string | READ_WRITE | The identifier of the selected subtitle track. Subtitles may or may not be visible on the screen, depending upon the user's caption mode setting. Reading this field will return the identifier of the subtitle track selected by the user. Writing this the field will change the track. See also: globalCaptionMode | ||||||||||||||||||||||
| currentSubtitleTrack | string | READ_ONLY | The identifier of the selected subtitle track. Subtitles may or may not be visible on the screen, depending upon the user's caption mode setting. Reading this field will return the identifier of the subtitle track that is playing. When the user has not selected a track, the Roku media player will select a track based on the preferred caption language system setting. | ||||||||||||||||||||||
| availableSubtitleTracks | array of associative arrays | [ ] empty array | READ_ONLY | The list of subtitle tracks available in the video stream. The array is initially populated with the tracks specified in the Content Meta-Data, and additional tracks are added if they are detected by the digital video player. Each associative array has the following entries:
| |||||||||||||||||||||
| captionStyle | associative array | system default | READ_WRITE | Allows apps to style closed captions. For any keys that are absent from the associative array, or for unexpected values, the Default value is assumed for that property. Following are the possible key names and values for this field:
|
Audio fields
| Field | Type | Default | Access Permission | Description | ||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| mute | Boolean | false | READ_WRITE | Set to true to mute the audio of the video currently playing in the Video node. Set to false to restore audio. | ||||||||||||||||||||||||||||||||||||||||||
| audioTrack | string | READ_WRITE | The track identifier of the selected audio track. Reading this field will return the track identifier of the audio selected by the user. Writing this value will change the audio track. However, apps should not do this unless they are implementing their own track selection menu that users control. This is because the Roku OS selects the best track automatically based on preferred language setting on the device. See Automatic audio track selection for more information. | |||||||||||||||||||||||||||||||||||||||||||
| currentAudioTrack | String | READ_ONLY | The track identifier of the audio being played. Reading this field will return the track that is being played, which may be different than the track being selected (for example, when the Roku media player cannot play a certain format). When the user has not selected an audio track, the platform will select a track based on the preferred audio language setting. | |||||||||||||||||||||||||||||||||||||||||||
| availableAudioTracks | array of associative arrays | [ ] empty array | READ_ONLY | Each associative array has the following entries:
The field also retrieves audio description tracks which are typically seen on broadcast TV. An audio description track is mixed with the main audio track. | ||||||||||||||||||||||||||||||||||||||||||
| seamlessAudioTrackSelection Available since Roku OS 13.0 | Boolean | false | READ_WRITE | Enables apps to continuously play video when the audio track is switched. This feature currently supports HLS only.
To enable this feature, you must set this field before sending any command to the Video node. This field may not be changed during video playback. | ||||||||||||||||||||||||||||||||||||||||||
| audioFormat | string | READ_ONLY | In all other cases they shouldn't .Contains the format of the currently playing audio.
| |||||||||||||||||||||||||||||||||||||||||||
| supplementaryAudioVolume | int | 50 | READ_WRITE | Sets the volume of the description tracks separately from the main audio track. The field value can range from 0 to 100. |
Automatic audio track selection
If multiple audio tracks are available for video content, the Roku OS automatically selects the best track based on the preferred audio track settings on the device (language, country code, and descriptive setting) and the quality of the audio track (bitrate/format).
The user can manually set their preferred language in the Settings > Audio > Audio preferred language menu, and the country code and descriptive setting are automatically set when the user selects an audio track. The preferred language setting is also automatically updated when the user selects an audio track (the preferred language is set to the language of the selected track).
For example, if the user chooses Portuguese as their preferred language, the Roku OS will by default select the Portuguese audio track the next time they watch content (if available). If the selected audio track is in Portuguese (Brazil), the user's preferred country is set to Brazil, and the Portuguese (Brazil) audio track is selected by default the next time the user watches content.
It is recommended that apps use the audio track selection logic provided by the Roku OS instead of implementing their own.
Overall, the Roku OS uses the following criteria (listed in order of priority) to determine which audio track to play:
-
Preferred audio track settings:
a. The track explicitly selected by the user.
b. The track with the user's preferred language, country code and descriptive setting.
c. The track with the preferred language and the country code.
d. The track with the preferred language that is marked as the default audio track.
e. The track with the preferred language.
f. The first track.
-
Highest quality audio track (based on bitrate/format)
Any language not included in the provided list of common languages is added to the list as the last entry. The common languages list may only have a single unlisted language. For example, if the user selects Korean as the audio track for a movie, the last entry in the common languages list is Korean, which is used as the preferred language from thereon. If the user then selects a Chinese audio track, Chinese overwrites Korean as the last entry in the common language list and is used as the preferred language.
CDN fields
Developers can receive event-based notifications when the CDN is switched during content playback.
| Attribute | Type | Values | Description | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cdnSwitch | roArray of roAssociativeArrays |
| Indicates that a CDN switching event has occurred. Apps can monitor this field in the background. When the Video player detects a CDN change, it automatically updates this field. |
Miscellaneous fields
| Field | Type | Default | Access Permission | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| MaxVideoDecodeResolution | vector2d (width, height) | [0,0] | READ_WRITE | Sets the max resolution required by your video. Video decode memory is a shared resource with OpenGL texture memory. The Brightscript 2D APIs are implemented using OpenGL texture memory on Roku models that support the Open GL APIs (see Hardware specifications for a list of these models). On models that do not support Open GL APIs, this field exists for API compatibility but has no effect on actual memory allocations. Video decode memory allocation is based on a resolution of 1920x1080 or 1280x720 as the maximum supported resolution for a particular Roku model (see Hardware specifications for a list of these models). This field enables applications that want to use both the 2D APIs and video playback with a lower resolution than 1080p. Without this field, these applications are likely to not have enough memory for either video playback or UI rendering. If width is 0 (the default), it is unlimited. If height is 0 (the default), it is unlimited. | ||||||||||
| cgms | integer | 0 | READ_WRITE | Sets the CGMS (Copy Guard Management System) on analog outputs to the desired level. The valid values are:
| ||||||||||
| enableScreenSaverWhilePlaying | Boolean | false | READ_WRITE | Set this to true to allow the screensaver to activate even if video is playing, as long as that video does not cover 50% or more of the screen. Set to false to block the screensaver activating if any video is playing. Note that this field has no effect when the video node plays audio only streams. For screensaver control with audio only streams, use the disableScreenSaver field. | ||||||||||
| disableScreenSaver | Boolean | false | READ_WRITE | Set this to true to suppress the screensaver. This is typically used to suppress the screensaver when playing audio-only streams. | ||||||||||
| contentBlocked | Boolean | false | READ_ONLY | Available since Roku OS 8. Determines whether the current content is blocked. |
Data bindings
See Content Meta-Data for the required and optional play parameters, and descriptive information for video playback. Set these parameters in a ContentNode node, and assign the ContentNode to the content field of the Video node to apply the parameters to a particular video content item.
For HTTPS access, note the following Content Meta-Data attributes:
HttpCertificatesFileHttpCookiesHttpHeadersHttpSendClientCertificates
These attributes must be set to handle secure HTTP transfers of video files. Note that this is a different HTTPS mechanism than used for other SceneGraph nodes as described in roHttpAgent.
Prior to Roku OS 7.2, each Audio and Video node created and configured an
HttpAgentonly when the first content was played in a given Audio or Video node instance. This sometimes meant that additional content would fail to play in the same node because headers, cookies, and certificates were not updated or correctly replaced from the new content record. Apps that are dependent upon this behavior will need to be updated to set the required data into the Content Meta-Data for each piece of content, or to programmatically set those values into theHttpAgentbefore playing each piece of content.
Example
To play video in an application, you first need to create a Video node, either in BrightScript using the roSGNode ifSGNodeChildren interface, or in XML markup. For example, in XML markup:
<Video
id="musicvideos"
width="1280"
height="720"
translation="[0,0]"
/>
The Video node is then scripted to specify the URL of the video stream, streaming format, video title, and any other Content Meta-Data attributes needed for the particular playback. Once the video properties are specified, the video can be played by setting the Video node control field value to play.
<script type="text/brightscript" >
<![CDATA[
sub init()
m.top.setFocus(true)
setVideo()
end sub
function setVideo() as void
videoContent = createObject("RoSGNode", "ContentNode")
videoContent.url = "https://roku.s.cpl.delvenetworks.com/media/59021fabe3b645968e382ac726cd6c7b/60b4a471ffb74809beb2f7d5a15b3193/roku_ep_111_segment_1_final-cc_mix_033015-a7ec8a288c4bcec001c118181c668de321108861.m3u8"
videoContent.title = "Test Video"
videoContent.streamformat = "hls"
m.video = m.top.findNode("musicvideos")
m.video.content = videoContent
m.video.control = "play"
end function
]]>
</script>Updated 3 months ago
