ed2d65b8 by Jon-Carlos Rivera

Merge pull request #615 from videojs/fix-flash-bandwidth

Fix the IE11 bug without introducing a massive bandwidth leak into Flash playback
2 parents 8da274bf 29d69fa7
......@@ -323,8 +323,8 @@ const filterBufferedRanges = function(predicate) {
// report a fully empty buffer until SourceBuffers have been created
// which is after a segment has been loaded and transmuxed.
if (!this.mediaSource ||
!this.mediaSource.mediaSource_ ||
!this.mediaSource.mediaSource_.sourceBuffers.length) {
(this.mediaSource.mediaSource_ &&
!this.mediaSource.mediaSource_.sourceBuffers.length)) {
return videojs.createTimeRanges([]);
}
......
......@@ -752,7 +752,7 @@ QUnit.test('starts downloading a segment on loadedmetadata', function() {
'the first segment is requested');
});
QUnit.test('always returns an empty buffered region when there are no SourceBuffers', function() {
QUnit.test('return an empty buffered region when there are no SourceBuffers but a real MediaSource exists', function() {
this.player.src({
src: 'manifest/media.m3u8',
type: 'application/vnd.apple.mpegurl'
......@@ -778,11 +778,11 @@ QUnit.test('always returns an empty buffered region when there are no SourceBuff
0,
'empty TimeRanges returned');
// Simulate the condition with no media source
// Simulate the condition with no media source (ie. Flash)
delete this.player.hls.mediaSource.mediaSource_;
QUnit.equal(this.player.tech_.hls.findBufferedRange_().length,
0,
QUnit.equal(this.player.tech_.hls.findBufferedRange_().end(0),
10,
'empty TimeRanges returned');
});
......