BRAVIA Professional Display allows you to embedded HDMI inputs into an application as described below. It is required to set the width attribute and the height attribute.
The last input source (e.g. HDMI 1) is shown in the HDMI Video object tag by default. It can be changed using the INPUT button on a remote commander. It can be changed by using IP Control as well.
BRAVIA Professional Display supports only one HDMI Video object tag in each HTML5 application.
Attributes
DOMString autoplay [1] autoplay specifies whether to show a blank screen or default external input when an HDMI Video object tag is created.
"off" shows a blank screen when an HDMI Video object tag is created. The HTML5 application needs to call open() to show the external input implicitly.
"on" shows the last external input when an HDMI Video object tag is created. This value is the default.
DOMString src [1] Thesrc specifies the URL of the external input. See details below.
Input Type
URI Example
Description
HDMI
extInput:hdmi?port=1
HDMI 1
HDMI
extInput:hdmi?port=2
HDMI 2
HDMI
extInput:hdmi?port=3
HDMI 3
HDMI
extInput:hdmi?port=4
HDMI 4
Component
extInput:component?port=1
Component 1
Component
extInput:component?port=2
Component 2
Component
extInput:component?port=3
Component 3
Component
extInput:component?port=4
Component 4
Wi-Fi Display
extInput:widi?port=1
Wi-Fi Display
CEC Recorder
extInput:cec?type=recorder&port=1
Recorder 1
CEC Recorder
extInput:cec?type=recorder&port=2
Recorder 2
CEC Recorder
extInput:cec?type=recorder&port=3
Recorder 3
CEC Player
extInput:cec?type=player&port=1
Player 1
CEC Player
extInput:cec?type=player&port=2
Player 2
CEC Player
extInput:cec?type=player&port=3
Player 3
CEC Tuner
extInput:cec?type=tuner&port=1
Tuner 1
CEC Tuner
extInput:cec?type=tuner&port=2
Tuner 2
CEC Tuner
extInput:cec?type=tuner&port=3
Tuner 3
Other CEC Device
extInput:cec?type=freeuse
General CEC device
[1] Supported version: WebAppRuntime v1.2.65.11.
Methods
void open() [1] open() starts showing the external input. When autoplay attribute is off, the HDMI Video object tag does not show the external input automatically. The HTML5 application needs to call open() to show the external input explicitly.
void close() [1] close() stops showing the external input and shows a blank screen.
void setWideMode(DOMString mode) setWideMode() fills the rectangle with video by stretching. It may be needed when showing a 4:3 video source in the decimated-video. setWideMode() has the following parameters:
DOMString mode
"16:9" is used to fill a 16:9 rectangle with video.
"normal" is used to show a video as-is.
[1] Supported version: WebAppRuntime v1.2.65.11.
Events
onInputChanged onInputChanged is called when the external input shown in the HDMI Video object tag has been changed. (e.g. This event is called when the external input is changed from HDMI 1 to HDMI 2.)
Example
Download a sample application. The following shows how to embed a decimated HDMI Video object tag to the HTML5 application.
BRAVIA Professional Display supports RTP and Raw-UDP multicast video streaming on HTML5 platform with the <object> element. The supported media formats are shown in below.
Container
Video
Audio
-
MPEG TS
AVC/HEVC/MPEG2[1]
AAC-LC/HE-AAC/MP1L2
[1] Multicast object element supports up to 1920x1080@30p framerate and 10Mbps bitrate.
In order for quick stream change and smooth streaming, video streams need to have frequent I-pictures with no B-picture.
Only one <object> element is available at a time. The object cannot be used with the <audio> element or the <video> element at the same time in the same window. Quick creation and deletion of those elements (<object>, <video> and <audio>) may cause problems due to internal state change and resource management.
The multicast protocol and address is represented in the following format.
void show(DOMString url, DOMString jsonParam) show() method changes and plays the stream using a passed url.
JSON
object.show('udp://239.0.0.64:5004');
jsonaParam option can handle the following options in JSON format[1].
param
Description
prebuffer_ms
The default duration (ms) that must be buffered for playback to start. Default is 20ms.
rebuffer_ms
The default duration (ms) that must be buffered for playback to resume after a rebuffer. Default is 50ms.
hardware_av_sync
When this flag is set to true, audio and video are synchronized in a hardware decoder and the limit of bitrate and frame rate is improved. However, stability is less than when av are synchronized in the software. The default value is false.
source
The parameter can specify the IGMPv3 source address.
allow_render_to_main
If true, render to main frame. If false, render to sub frame.
drm_key_id
When this flat is set to “proidiom_stadard”, Pro:Idiom M DRM is enabled.
blocking_mode
Using DRM contents, set this flag to true. The default value is false.
network_interface
“eth0”, “ap0”, “wlan0”
JSON
// set no options object.show('udp://239.0.0.64:5004', 0);// set options (prebuffer_ms:2000ms, rebuffer_ms:5000ms) object.show('udp://239.0.0.64:5004', {prebuffer_ms:2000, rebuffer_ms:4000});
[1] Supported version: WebAppRuntime v1.2.65.8 or later.
setWideMode(DOMString mode) setWideMode() has the following parameters:
DOMString mode
"16:9" is used to fill a 16:9 rectangle with video.
"normal" is used to show a video as-is.
setTextTrack(int) The setTextTrack(int) enables DVB subtitle. Set the index to the parameter to select text tracks.
DOMString getTextTrackList() The getTextTrackList() retrieves the list of available DVB subtitles. The result contains index and language information.
setAudioTrack(int) The setAudioTrack() can change the audio track. Set index to the parameter to select audio tracks.
DOMString getAudioTrackList() The getAudioTrackList() retrieves the list of available audio tracks. The result contains index and language information.
Events
onstatechange
onshow
Example
Please download a sample application that shows how to embed a Multicast Video Window to an application.
At most one multicast video stream can be embedded in a web page. The HTML and JavaScript snippets below show how to use it.
// return true on success, or falsefunctionstartMulticastPlayback(){varobject=document.getElementById('mcast');if (object.open() !=0) {returnfalse; }object.onshow=function(result) {if (result===0) {console.log('multicast object is opened'); } };object.onstatechange=function(state) {switch (state) {caseobject.STATE_CLOSE:caseobject.STATE_OPEN:caseobject.STATE_PREPARE_TO_PLAY:caseobject.STATE_SRC_CHANGING:caseobject.STATE_WAIT_FOR_DATA:caseobject.STATE_PLAYING:caseobject.STATE_CLOSING:default:console.log(state); } };returnobject.show('udp://239.0.0.64:5004') ===0;}// change streamsfunctionchangeStream(url){varobject=document.getElementById('mcast');object.show(url);// if need to configure buffer size, use below API.// var jsonText = '{"prebuffer_ms":2000,"rebuffer_ms":5000}';// var paramJson = JSON.parse(jsonText);// object.show(url, paramJson);}// change streams with paramsfunctionchangeStreamWithParams(url,paramJson){varobject=document.getElementById('mcast');object.show(url,paramJson);}// stop streamsfunctionstopMulticastPlayback(){varobject=document.getElementById('mcast');object.close();}
High Quality Image
BRAVIA Professional Display provides a special way to render an image file in high-quality in an application. In this case, an image is rendered in a 4K YUV physical plane separated from the RGB plane.
The DirectoryReader interface offers methods concerned with referring information of files and directories under the '/media' directory of a USB storage.
Attributes
DOMString result result is the result of directory entries in JSON format.
Methods
void getTree() getTree() method starts directory traversal at the specified path asynchronously. When the operation is finished, the result attribute is updated and the function assigned to onload is called. Or, onerror is called when the operation failed. The result is in JSON format that contains an array of nodes. Symbolic links are not followed.
void abort() abort() method cancels the request on the object. Then, onabort is called.
void readEntries(EntryCallback callback) readEntries() method returns directory entries one by one through the callback function. When it reaches the end of the directory entries, the callback function is called with null and onload is called. If the abort() method is called, directory reading is stopped immediately and onabort is called.
Result example If the target directory contains the following, onload is called with the following result in JSON format.
Included files:
readme.txt (file)
LICENSE (file)
src (directory with sub entries)
main.c (file)
plugins (empty directory)
Result
JavaScript
[{"name":"readme.txt","size":1234,"date":"Wed, 28 May 2014 17:00:00 GMT"},{"name":"LICENSE","size":5678,"date":"Wed, 28 May 2014 17:00:00 GMT"},{"name":"src","date":"Wed, 28 May 2014 17:00:00 GMT","children":[{"name":"main.c","size":321,"date":"Wed, 28 May 2014 17:00:00 GMT"}{"name":"plugins","date":"Wed, 28 May 2014 17:00:00 GMT","children":[],"items":[]}]}]
SystemEvents Interface
An application can receive notifications of system events by the SystemEvents interface. The below table shows supported event types.
Event type
Description
SystemEventsTypeId
SystemEventInfo
Power Status
Inform when the status of power is changed. (i.e. display is turned on or turned off.)
powerStatusChanged
PowerStatusInfo
Network Interface
Inform when the status of network interface (eth/wlan) is changed. (i.e. network interface is disabled or enabled.)
networkInterfaceChanged
NetworkInterfaceInfo
Network Connection
Inform when the status of network connection (eth/wlan) is changed. (i.e. network connection is established or disconnected.)
networkStatusChanged
NetworkStatusInfo
External Input Status
Inform when the status of external input (HDMI only) is changed. (i.e. external input is connected or disconnected with the other device or input signal is detected or lost.)
inputsStatusChanged
InputsStatusInfo
Volume Status
Inform when the volume or mute status is changed.
volumeInfoChanged
VolumeInfo
Request of Input Source Change[1]
Notify when the change of the input source is requested.
beforeInputSrcChange
InputSrcInfo
Completion of Input Source Change[1]
Notify when the change of the external input is completed.
inputSrcChanged
InputSrcInfo
[1] Supported only on WebAppRuntime v1.2.65.11.
The SystemEvents interface offers methods to inform the changes of system events (shown in the above table) to an application. An application can control their status by receiving system event status. (i.e. An application can add the decimated object tag only when external input event has been detected.)
void preventDefault() When the HTML5 application calls preventDefault(), the propagation of the event is stopped. Its default action should not be taken as it normally would be. The HTML5 application should handle its default action explicitly. This method is available in InputSrcInfo.
Enum: SystemEventsTypeId
It represents the system event types.
powerStatusChanged Inform RC ON and RC OFF
networkInterfaceChanged Inform network interface (eth/wlan) is enabled or disabled
networkStatusChanged Inform network connection is established, IP status is changed
inputsStatusChanged Inform external input status is changed (support only HDMI)
volumeInfoChanged Inform volume and mute status is changed
beforeInputSrcChange Notify when the change of the input source is requested.
inputSrcChanged Notify when the change of the external input is completed.
Interface: SystemEventInfo
SystemEventInfo is the base interface of each event status.
Attributes
DOMTimeStamp timeStamp timestamp shows the time when the event has been fired.
Interface: PowerStatusInfo
PowerStatusInfo inherits SystemEventInfo and represents the power information.
Attributes
PowerStatusType status
Enum: PowerStatusType
It represents the RC ON and OFF event types.
active This value represents RC ON
standby This value represents RC OFF
Interface: NetworkInterfaceInfo
NetworkInterfaceInfo inherits SystemEventInfo and represents the network interface (wlan and wired) information.
Attributes
NetworkInterfaceType netif This attribute shows the network interface which is enabled or disabled
boolean enabled
enabled shows the network interface is enabled or disabled.
VolumeInfo inherits SystemEventInfo and represents the volume status.
Attributes
Numeric volume volume shows volume value.
boolean mute mute shows volume is muted or not.
true if volume turn to muted.
false if mute is canceled.
Interface: InputSrcInfo
InputSrcInfo inherits SystemEventInfo and represents the information related to beforeInputSrcChange and inputSrcChanged .
Attributes
DOMString uri uri shows the URL of the external input.
DOMString title title shows the external input name (e.g. HDMI 1, HDMI 2, ...)
DOMString dispNum dispNum shows the sequence number of the external input (e.g. “HDMI 1”: “1”)
Example
Define and register callbacks
JavaScript
// define callback to handle Power Status eventsfunctiononPowerStatusChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.timestamp = "+event.eventMessage.timeStamp);console.log("eventMessage.status = "+event.eventMessage.status);}// define callback to handle Network Interface eventsfunctiononNetworkInterfaceChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.timestamp = "+event.eventMessage.timeStamp);console.log("eventMessage.netif = "+event.eventMessage.netif);console.log("eventMessage.enabled = "+event.eventMessage.enabled);}// define callback to handle Network Status eventsfunctiononNetworkStatusChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.timestamp = "+event.eventMessage.timeStamp);console.log("eventMessage.connectionInfo.netif = "+event.eventMessage.connectionInfo.netif);console.log("eventMessage.connectionInfo.errorDetail = "+event.eventMessage.connectionInfo.errorDetail);console.log("eventMessage.connectionInfo.hwAddress = "+event.eventMessage.connectionInfo.hwAddress);console.log("eventMessage.connectionInfo.ipAddrV4 = "+event.eventMessage.connectionInfo.ipAddrV4);console.log("eventMessage.connectionInfo.ipAddrV6 = "+event.eventMessage.connectionInfo.ipAddrV6);console.log("eventMessage.connectionInfo.netmask = "+event.eventMessage.connectionInfo.netmask);console.log("eventMessage.connectionInfo.gateway = "+event.eventMessage.connectionInfo.gateway);console.log("eventMessage.connectionInfo.dns = "+event.eventMessage.connectionInfo.dns);console.log("eventMessage.enabled = "+event.eventMessage.enabled);}// define callback to handle External Input Status eventsfunctiononInputsStatusChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.timestamp = "+event.eventMessage.timeStamp);console.log("eventMessage.uri = "+event.eventMessage.uri);console.log("eventMessage.title = "+event.eventMessage.title);console.log("eventMessage.connection = "+event.eventMessage.connection);console.log("eventMessage.status = "+event.eventMessage.status);}// define callback to handle Volume Status eventsfunctiononVolumeInfoChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.timestamp = "+event.eventMessage.timeStamp);console.log("eventMessage.volume = "+event.eventMessage.volume);console.log("eventMessage.mute = "+event.eventMessage.mute);}// define callback to handle request of Input Source ChangefunctiononBeforeInputSrcChange(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.url = "+event.eventMessage.url);console.log("eventMessage.title = "+event.eventMessage.title);console.log("eventMessage.dispNum = "+event.eventMessage.dispNum);}// define callback to handle completion of Input Source ChangefunctiononInputSrcChanged(event){console.log("systemEventTypeId = "+event.systemEventTypeId);console.log("eventMessage.url = "+event.eventMessage.url);console.log("eventMessage.title = "+event.eventMessage.title);console.log("eventMessage.dispNum = "+event.eventMessage.dispNum);}// register callbackssony.tv.systemevents.addListener('powerStatusChanged',onPowerStatusChanged);sony.tv.systemevents.addListener('networkInterfaceChanged',onNetworkInterfaceChanged);sony.tv.systemevents.addListener('networkStatusChanged',onNetworkStatusChanged);sony.tv.systemevents.addListener('inputsStatusChanged',onInputsStatusChanged);sony.tv.systemevents.addListener('volumeInfoChanged',onVolumeInfoChanged);sony.tv.systemevents.addListener('beforeInputSrcChange',onBeforeInputSrcChange);sony.tv.systemevents.addListener('inputSrcChanged',onInputSrcChanged);// unregister callbackssony.tv.systemevents.removeListener('powerStatusChanged',onPowerStatusChanged);sony.tv.systemevents.removeListener('networkInterfaceChanged',onNetworkInterfaceChanged);sony.tv.systemevents.removeListener('networkStatusChanged',onNetworkStatusChanged);sony.tv.systemevents.removeListener('inputsStatusChanged',onInputsStatusChanged);sony.tv.systemevents.removeListener('volumeInfoChanged',onVolumeInfoChanged);sony.tv.systemevents.removeListener('beforeInputSrcChange',onBeforeInputSrcChange);sony.tv.systemevents.removeListener('inputSrcChanged',onInputSrcChanged);
PictureMode Interface
The PictureMode interface offers methods to set and fix to a particular mode. By fixing the picture mode to a particular mode, an application can avoid a blinking screen even if the contents on it are changed.
Picture mode can be fixed in the manifest ("fixed_input: true"). In this case, the picture mode setting in the manifest is prioritized and this JavaScript API is ignored.
Methods Interface
DOMString getPictureMode() getPictureMode() method gets current picture mode.
void setPictureMode(DOMString mode) setPictureMode() method changes and fixes the picture mode. The mode parameter is one of three strings: 'VIDEO', 'PHOTO' and 'AUTO'. If the picture mode is set to other than 'AUTO', the picture mode is fixed until it is set to 'AUTO'.
Example
Set Picture Mode
JavaScript
functionsetPictureModeCall(mode){sony.tv.picturemode.setPictureMode(mode); }// Set picture mode as 'VIDEO'setPictureModeCall('VIDEO');// Set picture mode as 'PHOTO'setPictureModeCall('PHOTO');// Set picture mode as 'AUTO'setPictureModeCall('AUTO');