Skip to content

Commit

Permalink
fix(FEC-11374): Live DVR starting to cast from beginning of the DVR i…
Browse files Browse the repository at this point in the history
…nstead of Live edge (#51)
  • Loading branch information
Dan Ziv authored Jul 1, 2021
1 parent 2c10918 commit d096a0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions src/cast-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,6 @@ class CastEngine extends FakeEventTarget {
}

get currentTime(): number {
if (this.isLive()) {
return this._playerManager.getCurrentTimeSec() - this.getStartTimeOfDvrWindow();
}
if (this._ended) {
return this._playerManager.getDurationSec();
}
Expand Down Expand Up @@ -261,15 +258,17 @@ class CastEngine extends FakeEventTarget {
}

get duration(): number {
if (this.isLive()) {
const range = this._playerManager.getLiveSeekableRange();
if (range) {
return range.end - this.getStartTimeOfDvrWindow();
}
}
return this._playerManager.getDurationSec();
}

get liveDuration(): number {
const range = this._playerManager.getLiveSeekableRange();
if (range) {
return range.end;
}
return NaN;
}

get src(): string {
return this._isLoaded ? this._source.url : '';
}
Expand Down
2 changes: 1 addition & 1 deletion src/receiver-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class ReceiverManager {
if (this._player) {
mediaStatus.customData.mediaInfo = this._player.getMediaInfo();
if (this._player.isLive() && mediaStatus.media) {
mediaStatus.media.duration = this._player.duration;
mediaStatus.media.duration = this._player.liveDuration;
}
}
if (mediaStatus.playerState !== this._playerManager.getPlayerState()) {
Expand Down

0 comments on commit d096a0f

Please sign in to comment.