From 609733e2da9196249cd9e48a71439cd13f1a048a Mon Sep 17 00:00:00 2001 From: Shawn Busolits Date: Thu, 1 Mar 2018 11:06:26 -0500 Subject: [PATCH] fix: Fix undefined isMobile in sdk-impl. Fixes #541 --- src/controller.js | 11 +++++++++++ src/sdk-impl.js | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/controller.js b/src/controller.js index 85ee0afa..982c5b1f 100644 --- a/src/controller.js +++ b/src/controller.js @@ -115,6 +115,17 @@ Controller.prototype.getSettings = function() { return this.settings; }; + +/** + * Return whether or not we're in a mobile environment. + * + * @return {boolean} True if running on mobile, false otherwise. + */ +Controller.prototype.getIsMobile = function() { + return this.isMobile; +}; + + /** * Inject the ad container div into the DOM. * diff --git a/src/sdk-impl.js b/src/sdk-impl.js index 810f4a83..f44d0602 100644 --- a/src/sdk-impl.js +++ b/src/sdk-impl.js @@ -277,7 +277,7 @@ SdkImpl.prototype.onAdsManagerLoaded = function(adsManagerLoadedEvent) { google.ima.AdEvent.Type.SKIPPED, this.onAdComplete.bind(this)); - if (this.isMobile) { + if (this.controller.getIsMobile()) { // Show/hide controls on pause and resume (triggered by tap). this.adsManager.addEventListener( google.ima.AdEvent.Type.PAUSED,