Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
videojs-contrib-hls
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
2be08fa4
authored
2016-03-01 13:51:11 -0500
by
jrivera
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Work around a bug with the buffered property in IE11 that prevented playback
1 parent
2f10ecfc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
1 deletions
src/videojs-hls.js
test/videojs-hls_test.js
src/videojs-hls.js
View file @
2be08fa
...
...
@@ -887,6 +887,15 @@ var filterBufferedRanges = function(predicate) {
time
=
tech
.
currentTime
();
}
// IE 11 has a bug where it will report a the video as fully buffered
// before any data has been loaded. This is a work around where we
// 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_
.
sourceBuffers
.
length
)
{
return
videojs
.
createTimeRanges
([]);
}
if
(
buffered
&&
buffered
.
length
)
{
// Search for a range containing the play-head
for
(
i
=
0
;
i
<
buffered
.
length
;
i
++
)
{
...
...
test/videojs-hls_test.js
View file @
2be08fa
...
...
@@ -164,7 +164,13 @@ var
// a no-op MediaSource implementation to allow synchronous testing
MockMediaSource
=
videojs
.
extend
(
videojs
.
EventTarget
,
{
constructor
:
function
()
{},
constructor
:
function
()
{
this
.
mediaSource_
=
{
// Mock a fake sourceBuffer array because of an IE11 work-around
// in `filterBufferedRanges`
sourceBuffers
:
[
'fake'
]
};
},
duration
:
NaN
,
seekable
:
videojs
.
createTimeRange
(),
addSeekableRange_
:
function
(
start
,
end
)
{
...
...
@@ -708,6 +714,33 @@ test('starts downloading a segment on loadedmetadata', function() {
'the first segment is requested'
);
});
test
(
'always returns an empty buffered region when there are no SourceBuffers'
,
function
()
{
player
.
src
({
src
:
'manifest/media.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
player
.
tech_
.
buffered
=
function
()
{
return
videojs
.
createTimeRanges
([[
0
,
10
]]);
};
openMediaSource
(
player
);
standardXHRResponse
(
requests
[
0
]);
standardXHRResponse
(
requests
[
1
]);
player
.
currentTime
(
3
);
clock
.
tick
(
1
);
equal
(
player
.
tech_
.
hls
.
findBufferedRange_
().
end
(
0
),
10
,
'inside the first buffered region'
);
// Simulate the condition with no source buffers
player
.
hls
.
mediaSource
.
mediaSource_
.
sourceBuffers
=
[];
equal
(
player
.
tech_
.
hls
.
findBufferedRange_
().
length
,
0
,
'empty TimeRanges returned'
);
});
test
(
'finds the correct buffered region based on currentTime'
,
function
()
{
player
.
src
({
src
:
'manifest/media.m3u8'
,
...
...
Please
register
or
sign in
to post a comment