Player APIs (BrightScript & Ja...
JavaScript APIs
decoderconfiguration
10min
the decoderconfiguration object allows you to configure video decoders for mosaic mode decoderconfiguration idl interface decoderconfiguration { promise\<decoderconfigread> getconfig(); promise\<void> applyconfig(decoderconfig config); }; interface decoderconfigwritable { attribute string name; attribute string friendlyname; attribute string configuredsize; attribute int zindex; attribute bool mosaicdeinterlace; }; interface decoderconfig decoderconfigwritable { attribute string maxsize; attribute string mode; attribute int usagecount; attribute int maxusage; }; object creation to create a decoderconfiguration object, first load the brightsign/decoderconfiguration module using the require() method then create an instance of the decoderconfiguration class var decoderconfigurationclass = require("@brightsign/decoderconfiguration"); var decoderconfig = new decoderconfigurationclass(); decoderconfiguration use this interface to retrieve and modify video decoder data getconfig() promise \<decoderconfigarray> getconfig() returns an array of decoderconfig interfaces each interface describes a video decoder applyconfig() promise \<void> applyconfig(decoderconfigarray config) configures video decoder(s) for either standard mode or mosaic mode in standard mode, a single decoder is used to play a single video; in mosaic mode, the decoder can be used to decode multiple videos from different local or remote sources this method accepts an array of decoderconfig interfaces–attributes that are read only (e g maxsize ) will be ignored the system software selects which video decoder to use based on the resolution probed from the video file in standard mode, it will attempt to select the decoder that has the closest maximum supported resolution (i e 1920x1080 for the hd decoder and 3840x2160 for the 4k decoder), without exceeding that maximum resolution if a decoder has been configured for mosaic mode, it will match the video resolution against the specified configuredsize instead if two decoders support the same maximum resolution, you can select a decoder manually using the friendlyname attribute to select a decoder for an html video, include the decoder \[friendlyname] property with the html video docid\ e6ujleh69q0jmmv8kytrp \<video hwz= "decoder\ main video;" > \</video> \<video hwz= "decoder\ sd video;" > \</video> the maxusage value of a decoder determines how many video players can be assigned to the decoder using the system software algorithm described above—video players beyond the max usage limit may be assigned to another decoder or not displayed at all on the other hand, if you manually assign video players using the friendly name of the decoder, you can assign more video players to the decoder than the max usage limit, but this may cause unpredictable video display behavior decoderconfig this interface contains the settings of a video decoder it contains both editable and read only attributes editable name string string the system name of the video decoder (decoder availability differs by model) "4k1" the primary 4k decoder (xtx44 models only) "4k2" the secondary 4k decoder (xtx44 models only) "4k" the sole 4k decoder (hdx24, xtx43, 4kx42, xdx34, and xdx33 models only) "hd1" the first hd decoder "hd2" the second hd decoder friendlyname string string a name for referencing the decoder in html or brightscript configuredsize string string the maximum resolution that the decoder will accept (at framerates up to 60p) if this resolution is the same as the decoder's maximum resolution limit, the decoder will use standard mode; otherwise, it will use mosaic mode "4k" 3840x2160 "hd" 1920x1080 "sd" 720x576 "cif" 352x288 "qcif" 176x144 upscaling videos in mosaic mode currently causes severe performance degradation zindex int int the z index of the video window (in standard mode) or group of video windows (in mosaic mode) relative to the graphics plane 1 the video window (or group of windows) is positioned in front of the graphics plane 1 the video window (or group of windows) is positioned behind the graphics plane mosaicdeinterlace bool bool whether mosaic mode videos can be interlaced or not enabling the deinterlacer will allow playback of interlaced videos in mosaic mode, but will reduce the number of mosaic mode videos that can be decoded simultaneously as well read only maxsize string string the maximum resolution of the decoder, as set by system software this value can be either "4k" or "hd" mode string string the current mode of the decoder, which can be either "regular" or "mosaic" usagecount int int the number of videos currently being decoded by the decoder maxusage int int the maximum number of videos that can be decoded simultaneously by the decoder (this value is always 1 in "regular" mode) the optimum max usage limits are described below; the limit may be lower depending on a number of factors, including interlacing and frame rate 4k decoder 1 4k video 2 hd videos 4 sd videos 8 cif videos 10 qcif videos hd decoder 0 4k videos 1 hd video 3 sd videos 4 cif videos 5 qcif videos example this script retrieves the current video decoder configuration and modifies it so that the 4k decoder can be used to decode 2 hd videos var decoderconfigurationclass = require("@brightsign/decoderconfiguration"); var decoderconfig = new decoderconfigurationclass(); function finddecoder(element) { return element name === "4k"; }; function setdecoder(decoderlist) { decoder = decoderlist find(finddecoder); decoder friendlyname = "main video"; decoder configuredsize = "hd"; decoder zindex = 1; decoderconfig applyconfig(decoderlist) then() catch( function(data) { console log(json stringify(data)); }); }; decoderconfig getconfig() then( function(data) { setdecoder(data); }) catch( function(data) { console log(json stringify(data)); });