2016-03-18 63 views
5

我需要使用來自不同MediaStream的音頻和視頻創建MediaStream。將音頻和視頻軌道結合到新的MediaStream中

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

不幸的是,這並不在Chrome工作:

ReferenceError: MediaStream is not defined

有沒有在Chrome從組合音軌的替代方法在Firefox中,我可以從軌道的數組實例化一個新MediaStream分開的流?

回答

4

還是廠商前綴WebKit的:

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