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



我正在制作一个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必须为真

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

工作吗?

相关内容

最新更新