aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
Diffstat (limited to 'src/js')
-rw-r--r--src/js/plugins/ads.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/js/plugins/ads.js b/src/js/plugins/ads.js
index 5f19f6c7..f83948af 100644
--- a/src/js/plugins/ads.js
+++ b/src/js/plugins/ads.js
@@ -18,6 +18,7 @@ const getStartEvents = () => {
export default class Ads {
constructor(player) {
+ this.player = player;
// Check if an adTagUrl is provided.
if (!player.config.ads.adTagUrl) {
@@ -26,10 +27,15 @@ export default class Ads {
// Check if the Google IMA3 SDK is loaded.
if (!utils.is.object(window.google)) {
- utils.loadScript(player.config.urls.googleIMA.api);
+ utils.loadScript(player.config.urls.googleIMA.api, () => {
+ this.ready(this);
+ });
+ } else {
+ this.ready();
}
+ }
- this.player = player;
+ ready() {
this.startEvents = getStartEvents();
this.adDisplayContainer = null;
this.adDisplayElement = null;
@@ -47,7 +53,7 @@ export default class Ads {
this.setupIMA();
// Set listeners on the Plyr instance.
- // this.setupListeners();
+ this.setupListeners();
}
setupIMA() {