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
9ca16d6e
authored
2016-01-29 17:26:45 -0500
by
David LaPalomento
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge pull request #533 from dmlap/live-edge-constant
Make a constant for the live edge
2 parents
64aecaee
584b2b99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
5 deletions
src/playlist.js
src/playlist.js
View file @
9ca16d6
...
...
@@ -4,6 +4,16 @@
(
function
(
window
,
videojs
)
{
'use strict'
;
var
Playlist
=
{
/**
* The number of segments that are unsafe to start playback at in
* a live stream. Changing this value can cause playback stalls.
* See HTTP Live Streaming, "Playing the Media Playlist File"
* https://tools.ietf.org/html/draft-pantos-http-live-streaming-18#section-6.3.3
*/
UNSAFE_LIVE_SEGMENTS
:
3
};
var
duration
,
intervalDuration
,
backwardDuration
,
forwardDuration
,
seekable
;
backwardDuration
=
function
(
playlist
,
endSequence
)
{
...
...
@@ -186,13 +196,14 @@
// https://tools.ietf.org/html/draft-pantos-http-live-streaming-16#section-6.3.3
start
=
intervalDuration
(
playlist
,
playlist
.
mediaSequence
);
end
=
intervalDuration
(
playlist
,
playlist
.
mediaSequence
+
Math
.
max
(
0
,
playlist
.
segments
.
length
-
3
));
playlist
.
mediaSequence
+
Math
.
max
(
0
,
playlist
.
segments
.
length
-
Playlist
.
UNSAFE_LIVE_SEGMENTS
));
return
videojs
.
createTimeRange
(
start
,
end
);
};
// exports
videojs
.
Hls
.
Playlist
=
{
duration
:
duration
,
seekable
:
seekable
};
Playlist
.
duration
=
duration
;
Playlist
.
seekable
=
seekable
;
videojs
.
Hls
.
Playlist
=
Playlist
;
})(
window
,
window
.
videojs
);
...
...
Please
register
or
sign in
to post a comment