Skip to content

Commit

Permalink
fix(FEC-8910): seeking using keyboard shortcuts while ad causes conte…
Browse files Browse the repository at this point in the history
…nt seeking (#359)

Do not apply seeking using keyboard shortcuts while ad break
  • Loading branch information
yairans committed Feb 27, 2019
1 parent 06328e9 commit 10cd027
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 30 deletions.
68 changes: 38 additions & 30 deletions src/components/keyboard/keyboard.js
Expand Up @@ -144,42 +144,50 @@ class KeyboardControl extends BaseComponent {
}
},
[KeyMap.LEFT]: () => {
const newTime = this.player.currentTime - KEYBOARD_DEFAULT_SEEK_JUMP;
const from = this.player.currentTime;
const to = newTime > 0 ? newTime : 0;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.Rewind);
this.toggleHoverState();
return {from: from, to: to};
if (!(this.player.ads && this.player.ads.isAdBreak())) {
const newTime = this.player.currentTime - KEYBOARD_DEFAULT_SEEK_JUMP;
const from = this.player.currentTime;
const to = newTime > 0 ? newTime : 0;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.Rewind);
this.toggleHoverState();
return {from: from, to: to};
}
},
[KeyMap.RIGHT]: () => {
const newTime = this.player.currentTime + KEYBOARD_DEFAULT_SEEK_JUMP;
const from = this.player.currentTime;
const to = newTime > this.player.duration ? this.player.duration : newTime;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = newTime > this.player.duration ? this.player.duration : newTime;
this.props.updateOverlayActionIcon(IconType.SeekForward);
this.toggleHoverState();
return {from: from, to: to};
if (!(this.player.ads && this.player.ads.isAdBreak())) {
const newTime = this.player.currentTime + KEYBOARD_DEFAULT_SEEK_JUMP;
const from = this.player.currentTime;
const to = newTime > this.player.duration ? this.player.duration : newTime;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = newTime > this.player.duration ? this.player.duration : newTime;
this.props.updateOverlayActionIcon(IconType.SeekForward);
this.toggleHoverState();
return {from: from, to: to};
}
},
[KeyMap.HOME]: () => {
const from = this.player.currentTime;
const to = 0;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.StartOver);
this.toggleHoverState();
return {from: from, to: to};
if (!(this.player.ads && this.player.ads.isAdBreak())) {
const from = this.player.currentTime;
const to = 0;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.StartOver);
this.toggleHoverState();
return {from: from, to: to};
}
},
[KeyMap.END]: () => {
const from = this.player.currentTime;
const to = this.player.duration;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.SeekEnd);
this.toggleHoverState();
return {from: from, to: to};
if (!(this.player.ads && this.player.ads.isAdBreak())) {
const from = this.player.currentTime;
const to = this.player.duration;
this.logger.debug(`Seek. ${from} => ${to}`);
this.player.currentTime = to;
this.props.updateOverlayActionIcon(IconType.SeekEnd);
this.toggleHoverState();
return {from: from, to: to};
}
},
[KeyMap.M]: () => {
this.logger.debug(this.player.muted ? 'Umnute' : 'Mute');
Expand Down
1 change: 1 addition & 0 deletions src/components/playlist-countdown/_playlist-countdown.scss
Expand Up @@ -61,6 +61,7 @@
text-align: left;
color: #fff;
float: left;
line-height: initial;

.playlist-countdown-text-title {
font-size: 14px;
Expand Down

0 comments on commit 10cd027

Please sign in to comment.