Reputation: 9596
I am trying to stream "webm" video using media source api, I am following the demo code "http://html5-demos.appspot.com/static/media-source.html". I am not getting any errors but not playing.
here is my code
var type=entry.type; // it is always "video/webm"
var video=document.createElement("video");
var mediaSource = new MediaSource();
video.src = window.URL.createObjectURL(mediaSource);
mediaSource.addEventListener('webkitsourceopen', function(e) {
var sourceBuffer = mediaSource.addSourceBuffer(type+';codecs="vorbis,vp8"');
var obj=get({path:entry.path,request:"read"}); // this is my server get
obj.onstarted=function(url){
self.showVideo(video,url);
};
obj.onBlobRecieved=function(chunk){
//chunk is a blob
sourceBuffer.append(new Uint8Array(chunk));
}
obj.oncomplete=function(url){
video.play(); // for testing play on complete
}
},false);
I was debugged code, sourcebuffer always returns length 0;
how to resolve it?
Upvotes: 2
Views: 1560
Reputation: 905
If you are using the latest chrome then dont use webkitsourceopen. Instead use sourceopen . The prefixes have been disabled by defualt
Upvotes: 1