admin管理员组文章数量:1325954
Using userMedia I get a stream that contains both video and audio. Is there a way to separate them? Ie out of the one stream get 2 streams one that has only video and the other has only audio?
Using userMedia I get a stream that contains both video and audio. Is there a way to separate them? Ie out of the one stream get 2 streams one that has only video and the other has only audio?
Share Improve this question asked Dec 2, 2017 at 18:54 Ronen RabinoviciRonen Rabinovici 9,1326 gold badges38 silver badges46 bronze badges 1- This might be better to do server side with ffmpeg or something similar.. – Mr Zach Commented Dec 2, 2017 at 19:23
1 Answer
Reset to default 11Use the MediaStream
constructor to create new streams from the audio and video tracks:
let stream = await navigator.mediaDevices.getUserMedia({video: true, audio: true});
audioStream = new MediaStream(stream.getAudioTracks());
videoStream = new MediaStream(stream.getVideoTracks());
Here's a working fiddle.
本文标签: javascriptHtml5 separating audio stream from video streamStack Overflow
版权声明:本文标题:javascript - Html5 separating audio stream from video stream - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742190875a2430188.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论