Skip to content

Commit

Permalink
fix(FEC-8706): After pre-roll ad playing in cast and disconnect the v…
Browse files Browse the repository at this point in the history
…ideo starting from beginning (including pre-roll ad) (#191)


In case of VAST pre roll which already played in the receiver - configure empty ad tag so ads won't play again and after playback started configure the origin ad tag.
  • Loading branch information
Dan Ziv authored and OrenMe committed Dec 19, 2018
1 parent 9e61560 commit 792fed4
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions src/common/cast/remote-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,19 +180,26 @@ function reconstructPlayerComponents(snapshot: PlayerSnapshot): void {
const playerConfig = this._localPlayer.config;
// If the local player config contains ima, needs to destroy the player and create it from scratch
if (playerConfig.plugins && playerConfig.plugins.ima) {
let imaConfig = {};
// Configure ima such that continuous playback with ads will be start properly
Utils.Object.mergeDeep(playerConfig, {
plugins: {
ima: {
// Needs to wait for engine to create the new ads container
delayInitUntilSourceSelected: true,
adsRenderingSettings: {
// We don't want to play ads that already played in the receiver
playAdsAfterTime: snapshot.config.playback.startTime
}
if (!playerConfig.cast.advertising.vast) {
imaConfig = {
// Needs to wait for engine to create the new ads container
delayInitUntilSourceSelected: true,
adsRenderingSettings: {
// We don't want to play ads that already played in the receiver
playAdsAfterTime: snapshot.config.playback.startTime
}
}
});
};
// If it's a VAST ad we are empty the ad tag so ads won't play and configure it later
} else if (snapshot.config.playback.startTime > 0) {
const adTagUrl = playerConfig.plugins.ima.adTagUrl;
imaConfig = {
adTagUrl: ''
};
this._eventManager.listen(this, CoreEventType.FIRST_PLAYING, () => this.configure({plugins: {ima: {adTagUrl: adTagUrl}}}));
}
Utils.Object.mergeDeep(playerConfig, {plugins: {ima: imaConfig}});
// Destroy the local player and load new one
this._localPlayer.destroy();
this._remotePlayer = null;
Expand Down

0 comments on commit 792fed4

Please sign in to comment.