From bc69c50ccbfcb35d4f60bae9c43846d6204cd380 Mon Sep 17 00:00:00 2001 From: Dan Ziv Date: Mon, 7 Jun 2021 13:08:51 +0300 Subject: [PATCH] fix(FEC-11112): if cast after the playback started, Play button appears instead of Pause and the scrubber doesn't progress (#22) --- src/airplay.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/airplay.js b/src/airplay.js index 261a9e3..90eaa96 100644 --- a/src/airplay.js +++ b/src/airplay.js @@ -15,6 +15,7 @@ class AirPlay extends BasePlugin { } _isActive: boolean = false; + _wasPaused: boolean = false; constructor(name: string, player: KalturaPlayer, config: Object) { super(name, player, config); @@ -39,6 +40,7 @@ class AirPlay extends BasePlugin { startAirplay = () => { this.logger.debug('Start airplay request'); this.player.getVideoElement().webkitShowPlaybackTargetPicker(); + this._wasPaused = this.player.paused; }; _attachListeners() { @@ -67,6 +69,10 @@ class AirPlay extends BasePlugin { this._isActive = !this._isActive; this.logger.debug(`Activity changed to ${this._isActive.toString()}`); this.player.dispatchEvent(new FakeEvent(this._isActive ? EventType.AIRPLAY_STARTED : EventType.AIRPLAY_ENDED)); + if (this._isActive && !this._wasPaused) { + this.logger.debug(`Calling player play to sync UI`); + this.player.play(); + } }; }