问题
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