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
be8ad5db
authored
2015-03-19 22:18:55 -0400
by
bc-bbay
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Fixing bug that started playback at 2nd segment
Bugfix and unit test
1 parent
c4110efc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletions
src/videojs-hls.js
test/videojs-hls_test.js
src/videojs-hls.js
View file @
be8ad5d
...
...
@@ -666,7 +666,7 @@ videojs.Hls.prototype.drainBuffer = function(event) {
segmentOffset
,
segmentBuffer
=
this
.
segmentBuffer_
;
if
(
!
segmentBuffer
.
length
)
{
if
(
!
segmentBuffer
.
length
||
!
this
.
sourceBuffer
)
{
return
;
}
...
...
test/videojs-hls_test.js
View file @
be8ad5d
...
...
@@ -1724,6 +1724,41 @@ test('calling play() at the end of a video resets the media index', function() {
strictEqual
(
player
.
hls
.
mediaIndex
,
0
,
'index is 1 after the first segment'
);
});
test
(
'drainBuffer will not proceed with empty source buffer'
,
function
()
{
var
oldMedia
,
newMedia
,
compareBuffer
;
player
.
src
({
src
:
'https://example.com/encrypted-media.m3u8'
,
type
:
'application/vnd.apple.mpegurl'
});
openMediaSource
(
player
);
oldMedia
=
player
.
hls
.
playlists
.
media
;
newMedia
=
{
segments
:
[{
key
:
{
'retries'
:
5
},
uri
:
'http://media.example.com/fileSequence52-A.ts'
},
{
key
:
{
'method'
:
'AES-128'
,
'uri'
:
'https://priv.example.com/key.php?r=53'
},
uri
:
'http://media.example.com/fileSequence53-B.ts'
}]};
player
.
hls
.
playlists
.
media
=
function
()
{
return
newMedia
;
};
player
.
hls
.
sourceBuffer
=
undefined
;
compareBuffer
=
[{
mediaIndex
:
0
,
playlist
:
newMedia
,
offset
:
0
,
bytes
:
[
0
,
0
,
0
]}];
player
.
hls
.
segmentBuffer_
=
[{
mediaIndex
:
0
,
playlist
:
newMedia
,
offset
:
0
,
bytes
:
[
0
,
0
,
0
]}];
player
.
hls
.
drainBuffer
();
deepEqual
(
player
.
hls
.
segmentBuffer_
,
compareBuffer
,
'playlist remains unchanged'
);
player
.
hls
.
playlists
.
media
=
oldMedia
;
});
test
(
'calling fetchKeys() when a new playlist is loaded will create an XHR'
,
function
()
{
player
.
src
({
src
:
'https://example.com/encrypted-media.m3u8'
,
...
...
Please
register
or
sign in
to post a comment