HTML5: Play video from stored binary string

后端 未结 2 853
余生分开走
余生分开走 2021-02-10 07:44

I am trying to read the contents of a video file as a binary string using the FileReader.readAsBinaryString(Blob|File) as shown in the example http://www.html5rocks.com/en/tutor

相关标签:
2条回答
  • 2021-02-10 08:15

    How about FileReader.readAsDataURL(Blob|File) ?
    It is explained in your html5rocks-link as well.

    0 讨论(0)
  • 2021-02-10 08:28

    Your problem might be with the player.src

    player.src = "data:video/webm;base64,"+evt.target.result;
    

    It is expecting the data to be in base64 but you're giving it a binary string.

    Try encoding it to base64 using btoa

    player.src = "data:video/webm;base64,"+btoa(evt.target.result);
    
    0 讨论(0)
提交回复
热议问题