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
3bccfa73
authored
2014-03-17 15:22:34 -0400
by
Gary Katsevman
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix 'selects a playlist after segment downloads'
1 parent
088ba0d0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
3 deletions
test/videojs-hls_test.js
test/videojs-hls_test.js
View file @
3bccfa7
...
...
@@ -316,18 +316,47 @@ test('calculates the bandwidth after downloading a segment', function() {
'saves segment request time: '
+
player
.
hls
.
segmentXhrTime
+
's'
);
});
test
(
'selects a playlist after segment downloads'
,
function
()
{
asyncTest
(
'selects a playlist after segment downloads'
,
function
()
{
window
.
XMLHttpRequest
=
function
()
{
this
.
open
=
function
(
method
,
url
)
{
xhrUrls
.
push
(
url
);
};
this
.
send
=
function
()
{
var
self
=
this
;
setTimeout
(
function
()
{
var
manifestName
=
(
/
(?:
.*
\/)?(
.*
)\.
m3u8/
).
exec
(
xhrUrls
.
slice
(
-
1
)[
0
]);
if
(
manifestName
)
{
manifestName
=
manifestName
[
1
];
}
self
.
responseText
=
window
.
manifests
[
manifestName
||
xhrUrls
.
slice
(
-
1
)[
0
]];
self
.
response
=
new
Uint8Array
([
1
]).
buffer
;
self
.
readyState
=
4
;
self
.
onreadystatechange
();
},
0
);
};
this
.
abort
=
function
()
{};
};
var
calls
=
0
;
player
.
hls
(
'manifest/master.m3u8'
);
player
.
hls
.
selectPlaylist
=
function
()
{
calls
++
;
strictEqual
(
calls
,
1
,
'selects after the initial segment'
);
player
.
hls
.
selectPlaylist
=
function
()
{
calls
++
;
strictEqual
(
calls
,
2
,
'selects after additional segments'
);
start
();
return
player
.
hls
.
master
.
playlists
[
0
];
};
return
player
.
hls
.
master
.
playlists
[
0
];
};
videojs
.
mediaSources
[
player
.
currentSrc
()].
trigger
({
type
:
'sourceopen'
});
strictEqual
(
calls
,
1
,
'selects after the initial segment'
);
player
.
currentTime
=
function
()
{
return
1
;
};
...
...
@@ -335,7 +364,6 @@ test('selects a playlist after segment downloads', function() {
return
videojs
.
createTimeRange
(
0
,
2
);
};
player
.
trigger
(
'timeupdate'
);
strictEqual
(
calls
,
2
,
'selects after additional segments'
);
});
test
(
'moves to the next segment if there is a network error'
,
function
()
{
...
...
Please
register
or
sign in
to post a comment