From 7080f5cd3cda9aec5c94631288abfd17893e8e97 Mon Sep 17 00:00:00 2001 From: Anatoliy Klymenko Date: Sun, 3 Dec 2017 20:21:01 -0800 Subject: [PATCH] Prevent multiple license requests --- app/js/streaming/protection/ProtectionModel_01b.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/js/streaming/protection/ProtectionModel_01b.js b/app/js/streaming/protection/ProtectionModel_01b.js index 0a6c77dc3..db89572f4 100644 --- a/app/js/streaming/protection/ProtectionModel_01b.js +++ b/app/js/streaming/protection/ProtectionModel_01b.js @@ -68,6 +68,7 @@ MediaPlayer.models.ProtectionModel_01b = function () { // versions of the same events createEventHandler = function() { var self = this; + var keyRequestSent = false; return { handleEvent: function(event) { var sessionToken = null; @@ -77,6 +78,13 @@ MediaPlayer.models.ProtectionModel_01b = function () { var initData = ArrayBuffer.isView(event.initData) ? event.initData.buffer : event.initData; self.notify(MediaPlayer.models.ProtectionModel.eventList.ENAME_NEED_KEY, new MediaPlayer.vo.protection.NeedKey(initData, "cenc")); + // FIXME: this one is the obvious shortcut - should we delegate this to controller? + if (!keyRequestSent) { + videoElement[api.generateKeyRequest] + (self.keySystem.systemString, new Uint8Array(initData)); + keyRequestSent = true; + } + break; case api.keyerror: