diff --git a/app/js/streaming/protection/ProtectionController.js b/app/js/streaming/protection/ProtectionController.js index 21e6fb0f0..b18f8b6d6 100644 --- a/app/js/streaming/protection/ProtectionController.js +++ b/app/js/streaming/protection/ProtectionController.js @@ -644,8 +644,8 @@ MediaPlayer.dependencies.ProtectionController = function() { this.keySystem = undefined; + this.protectionModel.teardown(); this.setMediaElement(null).then(function() { - self.protectionModel.teardown(); self.protectionModel = undefined; }); }, diff --git a/app/js/streaming/protection/ProtectionModel_01b.js b/app/js/streaming/protection/ProtectionModel_01b.js index 0a6c77dc3..32f6e742a 100644 --- a/app/js/streaming/protection/ProtectionModel_01b.js +++ b/app/js/streaming/protection/ProtectionModel_01b.js @@ -409,7 +409,10 @@ MediaPlayer.models.ProtectionModel_01b = function () { closeKeySession: function(sessionToken) { // Send our request to the CDM - videoElement[api.cancelKeyRequest](this.keySystem.systemString, sessionToken.sessionID); + try { + // We might get INVALID_STATE exception if there are no outstanding requests - just ignore it + videoElement[api.cancelKeyRequest](this.keySystem.systemString, sessionToken.sessionID); + } catch (e) {} }, setServerCertificate: function(/*serverCertificate*/) { /* Not supported */ },