创建<video>并将媒体流附加到其中</video>

时间:2014-05-04 05:44:28

标签: javascript jquery webrtc

我正在申请WebRTC

基本上我有这段代码:

rtc.onremotestream = function(event) {
    //Want code to create a video tag in a specific <div> and then do this:
    attachMediaStream([THAT NEW VIDEO TAG], event.stream);
}

我怎么能这样做? Autoplay必须是真的。

1 个答案:

答案 0 :(得分:0)

rtc.onremotestream = function(event) {
  var videoTag = document.createElement('video');
  document.getElementById('specific_div').appendChild(videoTag);
  attachMediaStream(videoTag, event.stream);
}

作品?