多播视频

Estimated reading time: 3 minutes

BRAVIA商用显示器支持HTML5平台上的RTP和Raw-UDP多播视频流,元素为 <object> 支持的媒体格式如下所示。

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.

为了快速的流变换和流畅的流,视频流需要有频繁的i -picture而没有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.

多播协议和地址采用以下格式表示。

multicast-uri = scheme "://" host [":" port]
scheme = "rtp" / "udp"

方法

  • void show(DOMString url, DOMString jsonParam) The show() method changes and plays the stream using a passed url.
      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”
      // set no options
      object.show('udp://239.0.0.64:5004', 0);
      // set options
      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 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.

事件

  • 在状态改变
  • 展出

举例说明

Please download a sample application that shows how to embed a Multicast Video Window to an application.

一个网页最多只能嵌入一个多播视频流。 下面的HTML和JavaScript片段展示了如何使用它。

  • HTML
    <object id="mcast" type="application/x-multicast-video" width="960" height="540"></object>
    
  • JavaScript
    // return true on success, or false
    function startMulticastPlayback() {
      var object = document.getElementById('mcast');
    
      if (object.open() != 0) {
        return false;
      }
    
      object.onshow = function(result) {
        if (result === 0) {
          console.log('multicast object is opened');
        }
      };
    
      object.onstatechange = function(state) {
        switch (state) {
        case object.STATE_CLOSE:
        case object.STATE_OPEN:
        case object.STATE_PREPARE_TO_PLAY:
        case object.STATE_SRC_CHANGING:
        case object.STATE_WAIT_FOR_DATA:
        case object.STATE_PLAYING:
        case object.STATE_CLOSING:
        default:
          console.log(state);
        }
      };
    
      return object.show('udp://239.0.0.64:5004') === 0;
    }
    
    // change streams
    function changeStream(url) {
      var object = 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 params
    function changeStreamWithParams(url, paramJson) {
      var object = document.getElementById('mcast');
      object.show(url, paramJson);
    }
    
    // stop streams
    function stopMulticastPlayback() {
      var object = document.getElementById('mcast');
      object.close();
    }
    
Last modified: 10 Jun 2022