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
2ce0fbcb
authored
2014-08-19 17:24:25 -0400
by
Gary Katsevman
Committed by
David LaPalomento
2014-08-22 10:02:39 -0400
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
move transmuxing into drainBuffer
1 parent
05131ca4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
src/videojs-hls.js
src/videojs-hls.js
View file @
2ce0fbc
...
...
@@ -412,23 +412,15 @@ videojs.Hls.prototype.loadSegment = function(segmentUri, offset) {
tech
.
bandwidth
=
(
this
.
response
.
byteLength
/
tech
.
segmentXhrTime
)
*
8
*
1000
;
tech
.
bytesReceived
+=
this
.
response
.
byteLength
;
// transmux the segment data from MP2T to FLV
tech
.
segmentParser_
.
parseSegmentBinaryData
(
new
Uint8Array
(
this
.
response
));
tech
.
segmentParser_
.
flushTags
();
// package up all the work to append the segment
// if the segment is the start of a timestamp discontinuity,
// we have to wait until the sourcebuffer is empty before
// aborting the source buffer processing
tags
=
[];
while
(
tech
.
segmentParser_
.
tagsAvailable
())
{
tags
.
push
(
tech
.
segmentParser_
.
getNextTag
());
}
tech
.
segmentBuffer_
.
push
({
mediaIndex
:
tech
.
mediaIndex
,
playlist
:
tech
.
playlists
.
media
(),
offset
:
offset
,
tags
:
tags
bytes
:
this
.
response
});
tech
.
drainBuffer
();
...
...
@@ -447,6 +439,7 @@ videojs.Hls.prototype.drainBuffer = function(event) {
playlist
,
offset
,
tags
,
bytes
,
segment
,
ptsTime
,
...
...
@@ -460,7 +453,7 @@ videojs.Hls.prototype.drainBuffer = function(event) {
mediaIndex
=
segmentBuffer
[
0
].
mediaIndex
;
playlist
=
segmentBuffer
[
0
].
playlist
;
offset
=
segmentBuffer
[
0
].
offset
;
tags
=
segmentBuffer
[
0
].
tag
s
;
bytes
=
segmentBuffer
[
0
].
byte
s
;
segment
=
playlist
.
segments
[
mediaIndex
];
if
(
segment
.
key
)
{
...
...
@@ -489,6 +482,15 @@ videojs.Hls.prototype.drainBuffer = function(event) {
this
.
el
().
vjs_setProperty
(
'currentTime'
,
segmentOffset
*
0.001
);
}
// transmux the segment data from MP2T to FLV
this
.
segmentParser_
.
parseSegmentBinaryData
(
new
Uint8Array
(
bytes
));
this
.
segmentParser_
.
flushTags
();
tags
=
[];
while
(
this
.
segmentParser_
.
tagsAvailable
())
{
tags
.
push
(
this
.
segmentParser_
.
getNextTag
());
}
// if we're refilling the buffer after a seek, scan through the muxed
// FLV tags until we find the one that is closest to the desired
// playback time
...
...
Please
register
or
sign in
to post a comment