Reputation: 697
I am working on video player using Media Source Extensions API. For implementing Seek functionality I do following:
First use abort() method of SourceBuffer to abort current segment and resets the segment parser. then get new segment for currentTime and after that download new segment and append to SourceBuffer.
if (mediaSource.readyState == "open") {
mediaSource.sourceBuffers[0].abort();
}
var nextSegment = getCurrentSegment(vide.currentTime)
appendToBuffer(nextSegment)
everything works fine in chrome and firefox but in safari when seeking video it stops working and stuck (because of not adding the new segment to SourceBuffer).
After some research, I found out it's a safari MSE bug since version 9!
I want to know is there a workaround for this issue?
Upvotes: 3
Views: 1229
Reputation: 697
Its appear to be the only workaround is stubbing out an empty abort() function, its same way google shaka player use.
var addSourceBuffer = MediaSource.prototype.addSourceBuffer;
MediaSource.prototype.addSourceBuffer = function() {
var sourceBuffer = addSourceBuffer.apply(this, arguments);
sourceBuffer.abort = function() {}; // Stub out for buggy implementations.
return sourceBuffer;
};
Upvotes: 1