Skip to content

Commit

Permalink
feat: Add goToLive method (shaka-project#3527)
Browse files Browse the repository at this point in the history
  • Loading branch information
Álvaro Velad Galván authored Jul 14, 2021
1 parent ed1563f commit 84b9a89
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cast/cast_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ shaka.cast.CastUtils.PlayerVoidMethods = [
'selectVariantsByLabel',
'setTextTrackVisibility',
'trickPlay',
'goToLive',
];


Expand Down
13 changes: 13 additions & 0 deletions lib/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3130,6 +3130,19 @@ shaka.Player = class extends shaka.util.FakeEventTarget {
return {'start': 0, 'end': 0};
}

/**
* Go to live in a live stream.
*
* @export
*/
goToLive() {
if (this.isLive()) {
this.video_.currentTime = this.seekRange().end;
} else {
shaka.log.warning('goToLive is for live streams!');
}
}

/**
* Get the key system currently used by EME. If EME is not being used, this
* will return an empty string. If the player has not loaded content, this
Expand Down

0 comments on commit 84b9a89

Please sign in to comment.