I'm trying to follow this example about media source extensions.
I have a webm file at a given URL, and I want to append it to my video tag.
My code is:
Template.video.events({
'click button': function () {
var ms = new MediaSource();
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(ms);
ms.addEventListener('sourceopen', function(e) {
var sourceBuffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
var reader = new FileReader();
var file = File("video/movie.webm");
var chunck = reader.readAsArrayBuffer(file);
sourceBuffer.appendBuffer(chunck);
}, false);
}
});
How can transform the webm at the given URL in a arraybuffer so I can feed it to appendBuffer?