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
14e6480c
authored
2015-04-28 15:04:47 -0700
by
David LaPalomento
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'jsanford-bc-master'
Hand-merge for #256.
2 parents
1670a237
9ce3dc2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletions
src/videojs-hls.js
test/videojs-hls_test.js
src/videojs-hls.js
View file @
14e6480
...
...
@@ -459,6 +459,10 @@ videojs.Hls.prototype.selectPlaylist = function () {
// sort variants by resolution
bandwidthPlaylists
.
sort
(
videojs
.
Hls
.
comparePlaylistResolution
);
// forget our old variant from above, or we might choose that in high-bandwidth scenarios
// (this could be the lowest bitrate rendition as we go through all of them above)
variant
=
null
;
// iterate through the bandwidth-filtered playlists and find
// best rendition by player dimension
while
(
i
--
)
{
...
...
@@ -485,7 +489,7 @@ videojs.Hls.prototype.selectPlaylist = function () {
}
else
if
(
variant
.
attributes
.
RESOLUTION
.
width
<
player
.
width
()
&&
variant
.
attributes
.
RESOLUTION
.
height
<
player
.
height
())
{
// if we don't have an exact match, see if we have a good higher quality variant to use
if
(
oldvariant
.
attributes
&&
oldvariant
.
attributes
.
RESOLUTION
&&
if
(
oldvariant
&&
oldvariant
.
attributes
&&
oldvariant
.
attributes
.
RESOLUTION
&&
oldvariant
.
attributes
.
RESOLUTION
.
width
&&
oldvariant
.
attributes
.
RESOLUTION
.
height
)
{
resolutionPlusOne
=
oldvariant
;
}
...
...
test/videojs-hls_test.js
View file @
14e6480
...
...
@@ -852,6 +852,32 @@ test('selects the correct rendition by player dimensions', function() {
});
test
(
'selects the highest bitrate playlist when the player dimensions are '
+
'larger than any of the variants'
,
function
()
{
var
playlist
;
player
.
src
({
src
:
'manifest/master.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
openMediaSource
(
player
);
requests
.
shift
().
respond
(
200
,
null
,
'#EXTM3U\n'
+
'#EXT-X-STREAM-INF:BANDWIDTH=1000,RESOLUTION=2x1\n'
+
'media.m3u8\n'
+
'#EXT-X-STREAM-INF:BANDWIDTH=1,RESOLUTION=1x1\n'
+
'media1.m3u8\n'
);
// master
standardXHRResponse
(
requests
.
shift
());
// media
player
.
hls
.
bandwidth
=
1
e10
;
player
.
width
(
1024
);
player
.
height
(
768
);
playlist
=
player
.
hls
.
selectPlaylist
();
equal
(
playlist
.
attributes
.
BANDWIDTH
,
1000
,
'selected the highest bandwidth variant'
);
});
test
(
'does not download the next segment if the buffer is full'
,
function
()
{
var
currentTime
=
15
;
...
...
Please
register
or
sign in
to post a comment