admin管理员组文章数量:1393343
I am trying to capture a 5 minute long video from a web cam in a website.
I am currently using an html5 video element to display the getUserMedia result stream.
Is there anyway for me to get the contents of the stream once I finished with the recording?
I am left with a MediaStream object, and I guess it contains the video blob, can I access it somehow?
I am trying to capture a 5 minute long video from a web cam in a website.
I am currently using an html5 video element to display the getUserMedia result stream.
Is there anyway for me to get the contents of the stream once I finished with the recording?
I am left with a MediaStream object, and I guess it contains the video blob, can I access it somehow?
Share asked Oct 20, 2014 at 19:38 RemobaRemoba 1571 silver badge9 bronze badges2 Answers
Reset to default 2Saving a blob
const saveBlob = (function() {
const a = document.createElement('a');
document.body.appendChild(a);
a.style.display = 'none';
return function saveData(blob, fileName) {
const url = window.URL.createObjectURL(blob);
a.href = url;
a.download = fileName;
a.click();
};
}());
Usage: saveBlob(someBlob, 'filename');
Note: S.O. snippets blocks downloading so here's a runnable version
https://jsgist/?src=fe37a11d207f0f83a877e0c0252539c2
You could encode the video as a data URI and add a download link.
http://appcropolis./blog/web-technology/using-html5-canvas-to-capture-frames-from-a-video/ http://www.iandevlin./blog/2012/09/html5/html5-media-and-data-uri
本文标签: javascriptIs it possible to convert a MediaStream to a video blob with html5Stack Overflow
版权声明:本文标题:javascript - Is it possible to convert a MediaStream to a video blob with html5 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744649871a2617621.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论