Skip to content

Commit

Permalink
fix(FEC-11112): if cast after the playback started, Play button appea…
Browse files Browse the repository at this point in the history
…rs instead of Pause and the scrubber doesn't progress (#22)
  • Loading branch information
Dan Ziv authored Jun 7, 2021
1 parent 480c458 commit bc69c50
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/airplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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() {
Expand Down Expand Up @@ -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();
}
};
}

Expand Down

0 comments on commit bc69c50

Please sign in to comment.