From cb17bbbdd559a3a987b15e98da0ab90f56a0514d Mon Sep 17 00:00:00 2001 From: Alex Eng Date: Mon, 11 Apr 2016 16:54:39 -0700 Subject: [PATCH] [PBI-1666] -fixed an issue where we do not provide the correct shared video element on iOS to the IMA SDK when the original video element is destroyed and recreated --- js/google_ima.js | 1 + test/unit-tests/ima_test.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/js/google_ima.js b/js/google_ima.js index 8671ad3..7b0fb4a 100644 --- a/js/google_ima.js +++ b/js/google_ima.js @@ -2083,6 +2083,7 @@ require("../html5-common/js/utils/utils.js"); */ this.destroy = function() { + _ima.sharedVideoElement = null; }; /** diff --git a/test/unit-tests/ima_test.js b/test/unit-tests/ima_test.js index a7af1de..a2a863c 100644 --- a/test/unit-tests/ima_test.js +++ b/test/unit-tests/ima_test.js @@ -1307,4 +1307,15 @@ describe('ad_manager_ima', function() initialize(false); expect(ima.sharedVideoElement).to.not.be(null); }); + + it('SingleElement: Shared video element should be null after video wrapper calls destroy function', function() + { + ima.sharedVideoElement = null; + amc.ui.useSingleVideoElement = true; + amc.ui.ooyalaVideoElement = [{ className: "video"}]; + initAndPlay(false, vci); + expect(ima.sharedVideoElement).to.not.be(null); + videoWrapper.destroy(); + expect(ima.sharedVideoElement).to.be(null); + }); });