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
ad7a5bb4
authored
2015-09-16 14:30:53 -0400
by
jrivera
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Added a test to ensure that fillBuffer correctly handles multiple buffered ranges
1 parent
3193d8b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
3 deletions
test/videojs-hls_test.js
test/videojs-hls_test.js
View file @
ad7a5bb
...
...
@@ -1126,11 +1126,11 @@ test('downloads the next segment if the buffer is getting low', function() {
standardXHRResponse
(
requests
[
0
]);
standardXHRResponse
(
requests
[
1
]);
strictEqual
(
requests
.
length
,
2
,
'
did not make a request
'
);
player
.
currentTime
=
function
()
{
strictEqual
(
requests
.
length
,
2
,
'
made two requests
'
);
player
.
tech
.
currentTime
=
function
()
{
return
15
;
};
player
.
buffered
=
function
()
{
player
.
tech
.
buffered
=
function
()
{
return
videojs
.
createTimeRange
(
0
,
19.999
);
};
player
.
tech
.
hls
.
checkBuffer_
();
...
...
@@ -1143,6 +1143,69 @@ test('downloads the next segment if the buffer is getting low', function() {
'made segment request'
);
});
test
(
'buffers based on the correct TimeRange if multiple ranges exist'
,
function
()
{
player
.
tech
.
currentTime
=
function
()
{
return
8
;
};
player
.
tech
.
buffered
=
function
()
{
return
{
start
:
function
(
num
)
{
switch
(
num
)
{
case
0
:
return
0
;
case
1
:
return
50
;
}
},
end
:
function
(
num
)
{
switch
(
num
)
{
case
0
:
return
10
;
case
1
:
return
160
;
}
},
length
:
2
};
};
player
.
src
({
src
:
'manifest/media.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
openMediaSource
(
player
);
standardXHRResponse
(
requests
[
0
]);
standardXHRResponse
(
requests
[
1
]);
strictEqual
(
requests
.
length
,
2
,
'made two requests'
);
strictEqual
(
requests
[
1
].
url
,
absoluteUrl
(
'manifest/media-00001.ts'
),
'made segment request'
);
player
.
tech
.
currentTime
=
function
()
{
return
55
;
};
player
.
tech
.
hls
.
checkBuffer_
();
strictEqual
(
requests
.
length
,
2
,
'made no additional requests'
);
player
.
tech
.
currentTime
=
function
()
{
return
134
;
};
player
.
tech
.
hls
.
checkBuffer_
();
standardXHRResponse
(
requests
[
2
]);
strictEqual
(
requests
.
length
,
3
,
'made three requests'
);
strictEqual
(
requests
[
2
].
url
,
absoluteUrl
(
'manifest/media-00002.ts'
),
'made segment request'
);
});
test
(
'stops downloading segments at the end of the playlist'
,
function
()
{
player
.
src
({
src
:
'manifest/media.m3u8'
,
...
...
Please
register
or
sign in
to post a comment