Video stream through Websocket to <video> tag

前端 未结 1 1963
囚心锁ツ
囚心锁ツ 2021-01-31 00:03

I use Node.js to stream via Websocket a realtime webm video to a webpage which will play it in a tag. The following is the code from both the server and the client:

SER

相关标签:
1条回答
  • 2021-01-31 00:42

    Your example only contains the code that is shown on the rendered page from here: http://html5-demos.appspot.com/static/media-source.html

    Check the source code, line 155 is what you are missing:

    var file = new Blob([uInt8Array], {type: 'video/webm'});
    

    So, you need to tell the Blob the content type and then feed the buffer with Uint8Array (see line 171):

    sourceBuffer.append(new Uint8Array(e.target.result));
    
    0 讨论(0)
提交回复
热议问题