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
c5991ff3
authored
2016-10-06 20:00:55 -0400
by
Matthew Neil
Committed by
Jon-Carlos Rivera
2016-10-06 20:00:55 -0400
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
allow for initial bandwidth option of 0 (#855)
1 parent
a96dbc3e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletions
src/videojs-contrib-hls.js
test/videojs-contrib-hls.test.js
src/videojs-contrib-hls.js
View file @
c5991ff
...
...
@@ -342,7 +342,9 @@ class HlsHandler extends Component {
// start playlist selection at a reasonable bandwidth for
// broadband internet
// 0.5 MB/s
this
.
options_
.
bandwidth
=
this
.
options_
.
bandwidth
||
4194304
;
if
(
typeof
this
.
options_
.
bandwidth
!==
'number'
)
{
this
.
options_
.
bandwidth
=
4194304
;
}
// grab options passed to player.src
[
'withCredentials'
,
'bandwidth'
].
forEach
((
option
)
=>
{
...
...
test/videojs-contrib-hls.test.js
View file @
c5991ff
...
...
@@ -1262,6 +1262,32 @@ QUnit.test('if mode global option is used, mode is set to global option', functi
videojs
.
options
.
hls
=
hlsOptions
;
});
QUnit
.
test
(
'respects bandwidth option of 0'
,
function
()
{
this
.
player
.
dispose
();
this
.
player
=
createPlayer
({
html5
:
{
hls
:
{
bandwidth
:
0
}
}
});
this
.
player
.
src
({
src
:
'http://example.com/media.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
openMediaSource
(
this
.
player
,
this
.
clock
);
QUnit
.
equal
(
this
.
player
.
tech_
.
hls
.
bandwidth
,
0
,
'set bandwidth to 0'
);
});
QUnit
.
test
(
'uses default bandwidth option if non-numerical value provided'
,
function
()
{
this
.
player
.
dispose
();
this
.
player
=
createPlayer
({
html5
:
{
hls
:
{
bandwidth
:
'garbage'
}
}
});
this
.
player
.
src
({
src
:
'http://example.com/media.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
openMediaSource
(
this
.
player
,
this
.
clock
);
QUnit
.
equal
(
this
.
player
.
tech_
.
hls
.
bandwidth
,
4194304
,
'set bandwidth to default'
);
});
QUnit
.
test
(
'does not break if the playlist has no segments'
,
function
()
{
this
.
player
.
src
({
src
:
'manifest/master.m3u8'
,
...
...
Please
register
or
sign in
to post a comment