From a57eac9eed8a29d6cb130d6b1b560793bee8bac8 Mon Sep 17 00:00:00 2001 From: Dan Ziv Date: Tue, 3 Oct 2017 14:25:16 +0300 Subject: [PATCH 1/2] fix(FEC-7234): toggle playback on overlay ad click --- src/ima-state-machine.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ima-state-machine.js b/src/ima-state-machine.js index 370bca69..d0072dd8 100644 --- a/src/ima-state-machine.js +++ b/src/ima-state-machine.js @@ -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: { @@ -176,10 +176,10 @@ 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()) { + this._stateMachine.is(State.PLAYING) ? this.pauseAd() : this.resumeAd(); } else { - this.resumeAd(); + this.player.paused ? this.player.play() : this.player.pause(); } this.dispatchEvent(options.transition); } From 40548880c9dab38d99cc0d06f03d5d6346a571af Mon Sep 17 00:00:00 2001 From: Dan Ziv Date: Tue, 3 Oct 2017 22:53:36 +0300 Subject: [PATCH 2/2] Fix --- src/ima-state-machine.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ima-state-machine.js b/src/ima-state-machine.js index d0072dd8..39b66cd6 100644 --- a/src/ima-state-machine.js +++ b/src/ima-state-machine.js @@ -177,9 +177,13 @@ function onAdStarted(options: Object, adEvent: any): void { function onAdClicked(options: Object, adEvent: any): void { this.logger.debug(adEvent.type.toUpperCase()); if (this._currentAd.isLinear()) { - this._stateMachine.is(State.PLAYING) ? this.pauseAd() : this.resumeAd(); + if (this._stateMachine.is(State.PLAYING)) { + this.pauseAd(); + } } else { - this.player.paused ? this.player.play() : this.player.pause(); + if (!this.player.paused) { + this.player.pause(); + } } this.dispatchEvent(options.transition); }