Skip to content

Commit

Permalink
fix(FEC-7234): pause playback on overlay ad clicked (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Ziv committed Oct 3, 2017
1 parent 8cd6f9d commit 0def2ab
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ima-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export default class ImaStateMachine {
},
{
name: context.player.Event.AD_CLICKED,
from: [State.PLAYING, State.PAUSED]
from: [State.PLAYING, State.PAUSED, State.IDLE]
}
],
methods: {
Expand Down Expand Up @@ -176,10 +176,14 @@ function onAdStarted(options: Object, adEvent: any): void {
*/
function onAdClicked(options: Object, adEvent: any): void {
this.logger.debug(adEvent.type.toUpperCase());
if (this._stateMachine.is(State.PLAYING)) {
this.pauseAd();
if (this._currentAd.isLinear()) {
if (this._stateMachine.is(State.PLAYING)) {
this.pauseAd();
}
} else {
this.resumeAd();
if (!this.player.paused) {
this.player.pause();
}
}
this.dispatchEvent(options.transition);
}
Expand Down

0 comments on commit 0def2ab

Please sign in to comment.