Skip to content

Commit

Permalink
fix(ads): Fix stopping of Server Side Ad manager (shaka-project#3611)
Browse files Browse the repository at this point in the history
This change causes the safe SS-DAI settings to be reset when a stream is unloaded.
  • Loading branch information
Álvaro Velad Galván committed Sep 13, 2021
1 parent 56a0042 commit a17c988
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 3 additions & 11 deletions lib/ads/ad_manager.js
Expand Up @@ -438,21 +438,13 @@ shaka.ads.AdManager = class extends shaka.util.FakeEventTarget {
if (this.csAdManager_) {
this.csAdManager_.stop();
}
if (this.ssAdManager_) {
this.ssAdManager_.stop();
}

this.dispatchEvent(
new shaka.util.FakeEvent(shaka.ads.AdManager.AD_STOPPED));

// TODO:
// For SS DAI streams, if a different asset gets unloaded as
// part of the process
// of loading a DAI asset, stream manager state gets reset and we
// don't get any ad events.
// We need to figure out if it makes sense to stop the SS
// manager on unload, and, if it does, find
// a way to do it safely.
// if (this.ssAdManager_) {
// this.ssAdManager_.stop();
// }
this.stats_ = new shaka.ads.AdsStats();
}

Expand Down
10 changes: 9 additions & 1 deletion lib/ads/server_side_ad_manager.js
Expand Up @@ -201,7 +201,15 @@ shaka.ads.ServerSideAdManager = class {
* Resets the stream manager and removes any continuous polling.
*/
stop() {
this.streamManager_.reset();
// TODO:
// For SS DAI streams, if a different asset gets unloaded as
// part of the process
// of loading a DAI asset, stream manager state gets reset and we
// don't get any ad events.
// We need to figure out if it makes sense to stop the SS
// manager on unload, and, if it does, find
// a way to do it safely.
// this.streamManager_.reset();
this.backupUrl_ = '';
this.snapForwardTime_ = null;
}
Expand Down

0 comments on commit a17c988

Please sign in to comment.