Combining audio and video tracks into new MediaStream

百般思念 提交于 2020-05-09 01:24:11

问题


I need to get create a MediaStream using audio and video from different MediaStreams. In Firefox, I can instantiate a new MediaStream from an Array of tracks:

  var outputTracks = [];
  outputTracks = outputTracks.concat(outputAudioStream.getTracks());
  outputTracks = outputTracks.concat(outputVideoStream.getTracks());
  outputMediaStream = new MediaStream(outputTracks);

Unfortunately, this doesn't work in Chrome:

ReferenceError: MediaStream is not defined

Is there an alternative method in Chrome for combining tracks from separate streams?


回答1:


still vendor-prefixed with webkit:

  var outputTracks = [];
  outputTracks = outputTracks.concat(outputAudioStream.getTracks());
  outputTracks = outputTracks.concat(outputVideoStream.getTracks());
  outputMediaStream = new webkitMediaStream(outputTracks);


来源:https://stackoverflow.com/questions/36093376/combining-audio-and-video-tracks-into-new-mediastream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!