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
f8af9a26
authored
2016-07-25 14:27:25 -0400
by
Garrett
Committed by
Jon-Carlos Rivera
2016-07-25 14:27:25 -0400
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Restore backwards compatibility for overriding HlsHandler's selectPlaylist (#795)
1 parent
cf2b9066
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
1 deletions
src/videojs-contrib-hls.js
test/videojs-contrib-hls.test.js
src/videojs-contrib-hls.js
View file @
f8af9a2
...
...
@@ -381,7 +381,8 @@ class HlsHandler extends Component {
// `this` in selectPlaylist should be the HlsHandler for backwards
// compatibility with < v2
this
.
masterPlaylistController_
.
selectPlaylist
=
Hls
.
STANDARD_PLAYLIST_SELECTOR
.
bind
(
this
);
this
.
selectPlaylist
?
this
.
selectPlaylist
.
bind
(
this
)
:
Hls
.
STANDARD_PLAYLIST_SELECTOR
.
bind
(
this
);
// re-expose some internal objects for backwards compatibility with < v2
this
.
playlists
=
this
.
masterPlaylistController_
.
masterPlaylistLoader_
;
...
...
test/videojs-contrib-hls.test.js
View file @
f8af9a2
...
...
@@ -2478,6 +2478,50 @@ QUnit.test('live playlist starts three target durations before live', function()
});
QUnit
.
test
(
'uses user defined selectPlaylist from HlsHandler if specified'
,
function
()
{
let
origStandardPlaylistSelector
=
Hls
.
STANDARD_PLAYLIST_SELECTOR
;
let
defaultSelectPlaylistCount
=
0
;
Hls
.
STANDARD_PLAYLIST_SELECTOR
=
()
=>
defaultSelectPlaylistCount
++
;
let
hls
=
HlsSourceHandler
(
'html5'
).
handleSource
({
src
:
'manifest/master.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
},
this
.
tech
);
hls
.
masterPlaylistController_
.
selectPlaylist
();
QUnit
.
equal
(
defaultSelectPlaylistCount
,
1
,
'uses default playlist selector'
);
defaultSelectPlaylistCount
=
0
;
let
newSelectPlaylistCount
=
0
;
let
newSelectPlaylist
=
()
=>
newSelectPlaylistCount
++
;
HlsHandler
.
prototype
.
selectPlaylist
=
newSelectPlaylist
;
hls
=
HlsSourceHandler
(
'html5'
).
handleSource
({
src
:
'manifest/master.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
},
this
.
tech
);
hls
.
masterPlaylistController_
.
selectPlaylist
();
QUnit
.
equal
(
defaultSelectPlaylistCount
,
0
,
'standard playlist selector not run'
);
QUnit
.
equal
(
newSelectPlaylistCount
,
1
,
'uses overridden playlist selector'
);
newSelectPlaylistCount
=
0
;
let
setSelectPlaylistCount
=
0
;
hls
.
selectPlaylist
=
()
=>
setSelectPlaylistCount
++
;
hls
.
masterPlaylistController_
.
selectPlaylist
();
QUnit
.
equal
(
defaultSelectPlaylistCount
,
0
,
'standard playlist selector not run'
);
QUnit
.
equal
(
newSelectPlaylistCount
,
0
,
'overridden playlist selector not run'
);
QUnit
.
equal
(
setSelectPlaylistCount
,
1
,
'uses set playlist selector'
);
Hls
.
STANDARD_PLAYLIST_SELECTOR
=
origStandardPlaylistSelector
;
});
QUnit
.
module
(
'HLS - Encryption'
,
{
beforeEach
()
{
this
.
env
=
useFakeEnvironment
();
...
...
Please
register
or
sign in
to post a comment