Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  22] [ 6]  / answers: 1 / hits: 17649  / 11 Years ago, sat, april 27, 2013, 12:00:00

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 and then store and play the video.

I tried it using the below (with a webm video file),but get a Video format or MIME type not supported.

function readBlob (file, startByte, endByte, callback) {
console.log('readBlob():', file, startByte, endByte);

var reader = new FileReader();
reader.onloadend = function (evt) {
if ( == FileReader.DONE) {
var player = document.getElementById('player');
player.src = data:video/webm;base64,;
var blob = file.slice(startByte, endByte);

Does anyone know if it is possible to read a video file (one supported by the browser being used) as a binary string and play it in the browser HTML5 video player?


More From » html


Your problem might be with the player.src

player.src = data:video/webm;base64,;

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(;

[#78581] Friday, April 26, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 178
Total Questions: 105
Total Answers: 114

Location: Palau
Member since Tue, May 30, 2023
1 Year ago