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

Commit

Permalink
dont use tech for has played (#861)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjneil authored and forbesjo committed Oct 13, 2016
1 parent 2bf189b commit b0208f1
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/master-playlist-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export class MasterPlaylistController extends videojs.EventTarget {
seekable: () => this.seekable(),
seeking: () => this.tech_.seeking(),
setCurrentTime: (a) => this.tech_.setCurrentTime(a),
hasPlayed: () => this.hasPlayed_ || this.tech_.played().length !== 0,
hasPlayed: () => this.hasPlayed_,
bandwidth
};

Expand Down
3 changes: 2 additions & 1 deletion src/segment-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,8 @@ export default class SegmentLoader extends videojs.EventTarget {
// Under normal playback conditions fetching is a simple walk forward
if (mediaIndex !== null) {
log('++', mediaIndex + 1);
startOfSegment = playlist.segments[mediaIndex].end || lastBufferedEnd;
let segment = playlist.segments[mediaIndex];
startOfSegment = segment ? segment.end : lastBufferedEnd;
return this.generateSegmentInfo_(playlist, mediaIndex + 1, startOfSegment, false);
}

Expand Down
10 changes: 7 additions & 3 deletions src/sync-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ export default class SyncController {
}

if (timingInfo) {
this.calculateSegmentTimeMapping_(segmentInfo, timingInfo);
this.saveDiscontinuitySyncInfo_(segmentInfo);
if (this.calculateSegmentTimeMapping_(segmentInfo, timingInfo)) {
this.saveDiscontinuitySyncInfo_(segmentInfo);
}
}
}

Expand Down Expand Up @@ -305,10 +306,13 @@ export default class SyncController {

segment.start = segmentInfo.timestampOffset;
segment.end = timingInfo.end + mappingObj.mapping;
} else {
} else if (mappingObj) {
segment.start = timingInfo.start + mappingObj.mapping;
segment.end = timingInfo.end + mappingObj.mapping;
} else {
return false;
}
return true;
}

/**
Expand Down

0 comments on commit b0208f1

Please sign in to comment.