diff --git a/src/engines/html5/media-source/adapters/native-adapter.js b/src/engines/html5/media-source/adapters/native-adapter.js index 3c149bc68..38cc3702f 100644 --- a/src/engines/html5/media-source/adapters/native-adapter.js +++ b/src/engines/html5/media-source/adapters/native-adapter.js @@ -120,8 +120,6 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { _waitingEventTriggered: ?boolean = false; - _wasCurrentTimeSetSuccessfully: boolean; - _segmentDuration: number = 0; _startTimeOfDvrWindowInterval: IntervalID; @@ -335,7 +333,6 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { * @returns {Promise} - The loaded data */ load(startTime: ?number): Promise { - this._wasCurrentTimeSetSuccessfully = false; this._maybeSetDrmPlayback(); if (!this._loadPromise) { this._loadPromise = new Promise((resolve, reject) => { @@ -539,8 +536,8 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { this._handleLiveDurationChange(); } }; - if (!this.isLive()) { - this._setStartTime(startTime); + if (startTime !== undefined && startTime > -1) { + this._videoElement.currentTime = startTime; } if (this._videoElement.textTracks.length > 0) { parseTracksAndResolve(); @@ -554,7 +551,6 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { if (typeof startTime === 'number' && startTime > -1) { this._videoElement.currentTime = startTime; } - this._wasCurrentTimeSetSuccessfully = true; } _onTimeUpdate(): void { @@ -1250,10 +1246,6 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { return this._videoElement.duration === Infinity; } - isOnLiveEdge(): boolean { - return this._wasCurrentTimeSetSuccessfully ? super.isOnLiveEdge() : false; - } - /** * Handling live duration change (as safari doesn't trigger durationchange event on live playback) * @function _handleLiveDurationChange diff --git a/src/engines/html5/media-source/base-media-source-adapter.js b/src/engines/html5/media-source/base-media-source-adapter.js index dc3d9b722..d2c1d3dc0 100644 --- a/src/engines/html5/media-source/base-media-source-adapter.js +++ b/src/engines/html5/media-source/base-media-source-adapter.js @@ -221,6 +221,9 @@ export default class BaseMediaSourceAdapter extends FakeEventTarget implements I } isOnLiveEdge(): boolean { + if(this.getSegmentDuration()===0){ + return true; + } return this.liveDuration - this._videoElement.currentTime <= this.getSegmentDuration() * CURRENT_OR_NEXT_SEGMENT_COUNT; } diff --git a/src/player.js b/src/player.js index ca4b62237..d311a2e06 100644 --- a/src/player.js +++ b/src/player.js @@ -2249,7 +2249,7 @@ export default class Player extends FakeEventTarget { if (!this._firstPlay) { return outOfDvr; } else { - return !!this.src && !this.isOnLiveEdge(); + return (!!this.src && !this.isOnLiveEdge() && this._sources.startTime === undefined); } } return false;