Skip to content

Commit

Permalink
fix(FEC-11401): End key jumps over the live edge - regression (#623)
Browse files Browse the repository at this point in the history
use `liveDuration` and `getStartTimeOfDvrWindow` in live playback

Solves FEC-11401
  • Loading branch information
yairans committed Jul 14, 2021
1 parent 12dcac3 commit b446895
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 3 additions & 2 deletions src/components/forward/forward.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ class Forward extends Component {
let to;
const step = this.props.step || FORWARD_DEFAULT_STEP;
const from = player.currentTime;
if (player.currentTime + step > player.duration) {
const duration = player.isLive() ? player.liveDuration : player.duration;
if (player.currentTime + step > duration) {
// if user is already on live edge then dont even attempt to move forward in time
if (!player.isOnLiveEdge()) {
to = player.duration;
to = duration;
}
} else {
to = player.currentTime + step;
Expand Down
12 changes: 7 additions & 5 deletions src/components/rewind/rewind.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,21 @@ class Rewind extends Component {
* @memberof Rewind
*/
onClick = (): void => {
const {player} = this.props;
this.props.animate();
let to;
const step = this.props.step || REWIND_DEFAULT_STEP;
const from = this.props.player.currentTime;
if (this.props.player.currentTime - step < 0) {
const from = player.currentTime;
const basePosition = player.isLive() ? player.getStartTimeOfDvrWindow() : 0;
if (player.currentTime - step < basePosition) {
// In dvr when close to beginning dont rewind
if (!this.props.isDvr) {
to = 0;
to = basePosition;
}
} else {
to = this.props.player.currentTime - step;
to = player.currentTime - step;
}
this.props.player.currentTime = to;
player.currentTime = to;
this.props.notifyClick({
from: from,
to: to
Expand Down
16 changes: 11 additions & 5 deletions src/components/seekbar/seekbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,34 +256,40 @@ class SeekBar extends Component {
};
let newTime;
this.props.updatePlayerHoverState(true);
const basePosition = player.isLive() ? player.getStartTimeOfDvrWindow() : 0;
const duration = player.isLive() ? player.liveDuration : player.duration;
switch (event.keyCode) {
case KeyMap.LEFT:
if (!isAccessibility) {
this.props.updateOverlayActionIcon(IconType.Rewind);
}
newTime = player.currentTime - KEYBOARD_DEFAULT_SEEK_JUMP > 0 ? player.currentTime - 5 : 0;
newTime = player.currentTime - KEYBOARD_DEFAULT_SEEK_JUMP > basePosition ? player.currentTime - KEYBOARD_DEFAULT_SEEK_JUMP : basePosition;
seek(player.currentTime, newTime);
break;
case KeyMap.RIGHT:
if (!isAccessibility) {
this.props.updateOverlayActionIcon(IconType.Forward);
}
newTime = player.currentTime + KEYBOARD_DEFAULT_SEEK_JUMP > player.duration ? player.duration : player.currentTime + 5;
newTime = player.currentTime + KEYBOARD_DEFAULT_SEEK_JUMP > duration ? duration : player.currentTime + KEYBOARD_DEFAULT_SEEK_JUMP;
seek(player.currentTime, newTime);
break;
case KeyMap.HOME:
if (!isAccessibility) {
this.props.updateOverlayActionIcon(IconType.StartOver);
}
newTime = 0;
newTime = basePosition;
seek(player.currentTime, newTime);
break;
case KeyMap.END:
if (!isAccessibility) {
this.props.updateOverlayActionIcon(IconType.SeekEnd);
}
newTime = player.duration;
seek(player.currentTime, newTime);
if (player.isLive()) {
player.seekToLiveEdge();
} else {
newTime = duration;
seek(player.currentTime, newTime);
}
break;
}
}
Expand Down

0 comments on commit b446895

Please sign in to comment.