Adjusting live start time to 3 target durations
Changing the live start time from 30s to 3 target durations. Using 30s as a fallback if the playlist does not define a target duration.
Showing
3 changed files
with
5 additions
and
4 deletions
... | @@ -91,9 +91,10 @@ videojs.Hls.prototype.src = function(src) { | ... | @@ -91,9 +91,10 @@ videojs.Hls.prototype.src = function(src) { |
91 | 91 | ||
92 | videojs.Hls.setMediaIndexForLive = function(selectedPlaylist) { | 92 | videojs.Hls.setMediaIndexForLive = function(selectedPlaylist) { |
93 | var tailIterator = selectedPlaylist.segments.length, | 93 | var tailIterator = selectedPlaylist.segments.length, |
94 | tailDuration = 0; | 94 | tailDuration = 0, |
95 | targetTail = (selectedPlaylist.targetDuration || 10) * 3; | ||
95 | 96 | ||
96 | while (tailDuration < 30 && tailIterator > 0) { | 97 | while (tailDuration < targetTail && tailIterator > 0) { |
97 | tailDuration += selectedPlaylist.segments[tailIterator - 1].duration; | 98 | tailDuration += selectedPlaylist.segments[tailIterator - 1].duration; |
98 | tailIterator--; | 99 | tailIterator--; |
99 | } | 100 | } | ... | ... |
-
Please register or sign in to post a comment