Player APIs (BrightScript & Ja...
JavaScript APIs
videoinput
11min
the videoinput object allows you to retrieve information about the hdmi ® input and configure edid settings for it videoinput idl callback videoinputeventcallback = void (videoinputevent event); interface videoinputconfiguration { videoinputconfig defaultconfig(); promise\<videoinputconfig> getconfig(); promise\<status> applyconfig(videoinputconfig config); promise\<hdmiinputstatus> getstatus(); void addeventlistener(string type, videooutputeventcallback callback); void removeeventlistener(string type, videooutputeventcallback callback); }; interface videoinputconfig { attribute bool enableac3; attribute bool enableeac3; attribute bool enabletruehdmlp; attribute bool enabledts; attribute bool enabledtshd; attribute int maxsamplerate; attribute int maxchannelcount; attribute string lockaudioto; attribute bool disablehdcprepeater; attribute bool disableyuvcolor; }; interface status { attribute bool rebootrequired; }; interface hdmiinputstatus { attribute bool devicepresent; attribute int width; attribute int height; attribute bool interlaced; attribute float framerate; attribute float pixelclock; attribute string colorspace; attribute string audiotype; attribute int audiosamplingrate; }; object creation to create a videoinput object, first load the brightsign/videoinputmodule using the require() method then create an instance of the videoinput class var videoinputclass = require("@brightsign/videoinput"); var vi = new videoinputclass(); videoinputconfiguration use this interface to retrieve and modify video input data events a videoinputevent is raised when the hotplug status of the hdmi ® input changes it has one type property type the event type is hdmiinputchange methods defaultconfig() videoinputconfig defaultconfig() immediately returns a videoinputconfig interface containing default edid reporting values for the hdmi input getconfig() promise \<videoinputconfig> getconfig() returns a videoinputconfig interface containing the current edid reporting configuration for the hdmi input applyconfig() promise \<status> applyconfig(videoinputconfig config) configures edid reporting for the hdmi input by default, the input edid includes video modes from the display attached to the hdmi output, some video modes supported by the player, and support for pcm audio up to 48khz; it does not report proprietary media codecs that can be decoded by the device connected to the hdmi output, so you can use this method to announce such support if available at the endpoint this method returns a promise containing a status interface that indicates whether a reboot is required for the specified edid reporting settings to take effect getstatus() promise \<hdmiinputstatus> getstatus() returns the current status of the hdmi input close() promise \<void> close() this method shuts down the instance, preventing it from further consuming resources if it is not called, garbage collection determines when the instance will be destroyed videoinputconfig this interface contains configuration data related to the video input enableac3 bool bool a flag specifying whether ac 3 is supported enableeac3 bool bool a flag specifying whether e ac 3 is supported enabletruehdmlp bool bool a flag specifying whether truehd mlp is supported enabledts bool bool a flag specifying whether dts is supported enabledtshd bool bool a flag specifying whether dts hd is supported maxsamplerate int int the maximum supported pcm audio sampling rate in hz (e g the default sampling rate is 48000) maxchannelcount int int the number of pcm channels that are advertised over edid the default value is 2, which allows for stereo mixdown increasing this value to 6 allows the source to send multichannel pcm if ac 3 or e ac 3 is enabled on the player, multichannel audio is supported regardless of the m axchannelcount setting maxhdcpversion int int the maximum supported version of hdcp advertised by the hdmi input the default value is 2, which indicates support for hdcp 2 2 it can also be set to 1, which limits advertised support to hdcp 1 4 lockaudioto string string whether the audio sample rate clock is locked to the video clock (" video ") or audio clock (" audio ") of the incoming hdmi signal the determination can also be left to the system software (" auto ") disablehdcprepeater bool bool disables the hdcp repeater functionality if set to true , the source device attached to the hdmi input will see the device as not being hdcp capable and will downgrade the video it sends, or not send it at all disableyuvcolor bool bool alters the edid that the player sends to devices attached to the hdmi input if set to true , it will advertise that it only supports rgb video modes and not yuv modes status this interface is returned by the applyconfig() method rebootrequired bool bool a flag indicating whether or not a reboot is required for the change in edid settings to take effect hdmiinputstatus this interface contains information about the video source connected to the hdmi input devicepresent bool bool whether an hdmi input source is present ( true ) or not ( false ) width int int the width of the source video height int int the height of the source video interlaced bool bool a flag indicating whether the video source is interlaced framerate float float the framerate of the source video pixelclock float float the pixel clock rate of the source video (in mhz) colorspace string string the color space of the source video, which can be one of the following " rgb ", " ycbcr420 ", " ycbcr422 ", " ycbcr444 " audiotype string string the audio encoding of the source video, which can be either " pcm " or " compressed " audiosamplingrate int int the audio sampling rate of the source video (in hz) example var videoinputclass = require("@brightsign/videoinput"); var vi = new videoinputclass(); var inputconfig = {}; inputconfig enableac3 = true; vi applyconfig(inputconfig) then( function(data) { if (data rebootrequired === true) { system reboot(); } else { console log("reboot not required ") } }) catch( function(data) { console log(json stringify(data)); }); vi getconfig() then( function(data) { console log(" current config "); console log(json stringify(data)); }) catch( function(data) { console log(json stringify(data)); });