Skip to content

Commit da2cbb7

Browse files
committed
- rename INTERNAL_KEY_STATUSES_CHANGED into INTERNAL_KEY_STATUS_CHANGED
- keep sending public event KEY_STATUSES_CHANGED when statuses changed
1 parent b499b26 commit da2cbb7

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/streaming/protection/ProtectionEvents.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ class ProtectionEvents extends EventsBase {
5858
this.INTERNAL_KEY_SYSTEM_SELECTED = 'internalKeySystemSelected';
5959

6060
/**
61-
* Event ID for events delivered when the status of one or more
62-
* decryption keys has changed
61+
* Event ID for events delivered when the status of one decryption keys has changed
6362
* @ignore
6463
*/
65-
this.INTERNAL_KEY_STATUSES_CHANGED = 'internalkeyStatusesChanged';
64+
this.INTERNAL_KEY_STATUS_CHANGED = 'internalkeyStatusChanged';
6665

6766
/**
6867
* Event ID for events delivered when a new key has been added

src/streaming/protection/controllers/ProtectionController.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function ProtectionController(config) {
9090
// Once Keysystem is selected and before creating the session, we will do that check
9191
// so we create the strictly necessary DRM sessions
9292
eventBus.on(events.INTERNAL_KEY_MESSAGE, onKeyMessage, this);
93-
eventBus.on(events.INTERNAL_KEY_STATUSES_CHANGED, onKeyStatusesChanged, this);
93+
eventBus.on(events.INTERNAL_KEY_STATUS_CHANGED, onKeyStatusChanged, this);
9494

9595
mediaInfoArr.push(mediaInfo);
9696

@@ -287,7 +287,7 @@ function ProtectionController(config) {
287287
function reset() {
288288

289289
eventBus.off(events.INTERNAL_KEY_MESSAGE, onKeyMessage, this);
290-
eventBus.off(events.INTERNAL_KEY_STATUSES_CHANGED, onKeyStatusesChanged, this);
290+
eventBus.off(events.INTERNAL_KEY_STATUS_CHANGED, onKeyStatusChanged, this);
291291

292292
setMediaElement(null);
293293

@@ -438,11 +438,11 @@ function ProtectionController(config) {
438438
eventBus.trigger(events.LICENSE_REQUEST_COMPLETE, {data: data, error: error});
439439
}
440440

441-
function onKeyStatusesChanged(e) {
442-
if (!e.error) {
443-
log('[DRM] Key statuses changed. statuses = ' + e.data);
444-
} else {
441+
function onKeyStatusChanged(e) {
442+
if (e.error) {
445443
eventBus.trigger(events.KEY_STATUSES_CHANGED, {data: null, error: 'DRM: KeyStatusChange error! -- ' + e.error});
444+
} else {
445+
log('DRM: key status = ' + e.status);
446446
}
447447
}
448448

src/streaming/protection/models/ProtectionModel_21Jan2015.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ function ProtectionModel_21Jan2015(config) {
332332
handleEvent: function (event) {
333333
switch (event.type) {
334334
case 'keystatuseschange':
335-
eventBus.trigger(events.INTERNAL_KEY_STATUSES_CHANGED, {data: this});
335+
eventBus.trigger(events.KEY_STATUSES_CHANGED, {data: this});
336336
event.target.keyStatuses.forEach(function () {
337-
// has Edge and Chrome implement different version of keystatues, param are not on same order
337+
// Edge and Chrome implement different version of keystatues, param are not on same order
338338
let status, keyId;
339339
if (arguments && arguments.length > 0) {
340340
if (arguments[0]) {
@@ -355,9 +355,10 @@ function ProtectionModel_21Jan2015(config) {
355355
}
356356
switch (status) {
357357
case 'expired':
358-
eventBus.trigger(events.INTERNAL_KEY_STATUSES_CHANGED, {error: 'License has expired'});
358+
eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, {error: 'License has expired'});
359359
break;
360360
default:
361+
eventBus.trigger(events.INTERNAL_KEY_STATUS_CHANGED, {status: status, keyId: keyId});
361362
break;
362363
}
363364
});

0 commit comments

Comments
 (0)