Skip to content

Commit

Permalink
fix(FEC-9088): play button displayed instead of pause, when playback …
Browse files Browse the repository at this point in the history
…started anew in loop (loopback) (#12)

The issue comes from DAI SDK that fires 'AD_BREAK_ENDED' before the ad actually ended. 
This causes the player to replay without `PLAY` event (the player is still playing)
I’ve opened an issue - https://groups.google.com/forum/#!topic/ima-sdk/NrHGD2KfTlY
Listening to 'ENDED' event as a workaround solves the issue.

**Also fixes FEC-9101**
  • Loading branch information
yairans authored May 19, 2019
1 parent 216a5aa commit dbbe99c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ima-dai.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,18 @@ class ImaDAI extends BasePlugin implements IAdsControllerProvider, IEngineDecora
const allCuesPlayed = !this._cuePoints.find(cuePoints => !cuePoints.played);
const adBreak = this.player.ads.getAdBreak();
this._dispatchAdEvent(EventType.AD_BREAK_END);
if (allCuesPlayed || adBreak.type === AdBreakType.POST) {
const dispatchAllAdsCompleted = () => {
this._state = ImaDAIState.DONE;
this._dispatchAdEvent(EventType.ALL_ADS_COMPLETED);
};
if (adBreak.type === AdBreakType.POST) {
if (this._engine.ended) {
dispatchAllAdsCompleted();
} else {
this.eventManager.listenOnce(this._engine, EventType.ENDED, dispatchAllAdsCompleted);
}
} else if (allCuesPlayed) {
dispatchAllAdsCompleted();
}
if (this._savedSeekTime) {
this.player.currentTime = this._savedSeekTime;
Expand Down

0 comments on commit dbbe99c

Please sign in to comment.