简体   繁体   中英

How to send a video blob to a node.js server by converting it to binary packets?

I am using html5 getUserMedia to attain the user's webcam stream and is stored into an object namely stream now i want to send it to the server using socket.io. When I use follwing code i get an array

    navigator.getUserMedia  = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;
var video=document.querySelector("#outputview");
if( navigator.getUserMedia ) 
{
    navigator.getUserMedia( {video: true, audio: true},successcallback,errorcallback);
    function successcallback( stream ) 
    {
        video.src = window.URL.createObjectURL(stream);
        var socket = io('http://192.168.1.102:8000');
        socket.emit('data',stream);`

How to convert this into a data stream so that i could send this stream to view in another page?

你可以从这个演示中得到一些帮助https://github.com/LingyuCoder/SkyRTC-demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM