From 8445b9dc7233d7a1b103301458f9e8c8107b2c63 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Mon, 11 Jan 2016 16:57:14 -0800 Subject: [PATCH] Fix SourceBuffer.remove() calls for IE11 On IE11, SourceBuffer.remove(start, Number.POSITIVE_INFINITY) triggers an 'updateend' event, but does not seem to remove anything. The same is true if we swap Number.MAX_VALUE for Number.POSITIVE_INFINITY. MediaSource.duration does seem to work, though, to remove all content from buffer. Fixes #251 Change-Id: I67152f8deceb8926ae1376fdccf73db0c62d0a3e --- lib/media/source_buffer_manager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/media/source_buffer_manager.js b/lib/media/source_buffer_manager.js index f835f79020..72d8b21db6 100644 --- a/lib/media/source_buffer_manager.js +++ b/lib/media/source_buffer_manager.js @@ -562,7 +562,7 @@ shaka.media.SourceBufferManager.prototype.clear_ = function() { try { // This will trigger an 'updateend' event. - this.sourceBuffer_.remove(0, Number.POSITIVE_INFINITY); + this.sourceBuffer_.remove(0, this.mediaSource_.duration); } catch (exception) { return Promise.reject(exception); } @@ -608,7 +608,7 @@ shaka.media.SourceBufferManager.prototype.clearAfter_ = function(timestamp) { // This will trigger an 'updateend' event. this.sourceBuffer_.remove( this.inserted_[index + 1].startTime, - Number.POSITIVE_INFINITY); + this.mediaSource_.duration); } catch (exception) { return Promise.reject(exception); }