Skip to content
This repository has been archived by the owner on Jan 12, 2019. It is now read-only.

Commit

Permalink
Revert "Fix possible seek issues in content where segment preciseDura…
Browse files Browse the repository at this point in the history
…tion is shorter than playlist segment duration"

This reverts commit 1fcdef2.
  • Loading branch information
Jernej Fijačko committed Jun 18, 2015
1 parent 1fcdef2 commit c43b4be
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/videojs-hls.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,8 +791,6 @@ videojs.Hls.prototype.drainBuffer = function(event) {
decrypter,
segIv,
ptsTime,
tagPts,
tagIndex,
segmentOffset = 0,
segmentBuffer = this.segmentBuffer_;

Expand Down Expand Up @@ -891,23 +889,14 @@ videojs.Hls.prototype.drainBuffer = function(event) {
if (typeof offset === 'number') {
ptsTime = offset - segmentOffset + tags[0].pts;

tagPts = tags[i].pts;
tagIndex = i;
while (tagPts < ptsTime) {
while (tags[i].pts < ptsTime) {
i++;
if (tags[i] !== undefined) {
tagPts = tags[i].pts;
tagIndex = i;
}
else {
break;
}
}

// tell the SWF where we will be seeking to
this.el().vjs_setProperty('currentTime', (tagPts - tags[0].pts + segmentOffset) * 0.001);
this.el().vjs_setProperty('currentTime', (tags[i].pts - tags[0].pts + segmentOffset) * 0.001);

tags = tags.slice(tagIndex);
tags = tags.slice(i);

this.lastSeekedTime_ = null;
}
Expand Down Expand Up @@ -1136,15 +1125,14 @@ videojs.Hls.getMediaIndexByTime = function() {
* @returns {number} The current time to that point, or 0 if none appropriate.
*/
videojs.Hls.prototype.getCurrentTimeByMediaIndex_ = function(playlist, mediaIndex) {
var index, time = 0, segment;
var index, time = 0;

if (!playlist.segments || mediaIndex === 0) {
return 0;
}

for (index = 0; index < mediaIndex; index++) {
segment = playlist.segments[index];
time += segment.preciseDuration || segment.duration || playlist.targetDuration || 0;
time += playlist.segments[index].duration;
}

return time;
Expand Down

0 comments on commit c43b4be

Please sign in to comment.