Skip to content

Commit d90a681

Browse files
authored
Add persistentState and distinctiveIdentifier to new UI (Dash-Industry-Forum#4991)
1 parent 32e7489 commit d90a681

5 files changed

Lines changed: 305 additions & 68 deletions

File tree

index.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4726,6 +4726,9 @@ export interface ProtectionData {
47264726
/** Distinctive identifier (see https://www.w3.org/TR/encrypted-media/#dom-mediakeysystemconfiguration-distinctiveidentifier) */
47274727
distinctiveIdentifier?: string;
47284728

4729+
/** Persistent state requirement (see https://www.w3.org/TR/encrypted-media/#dom-mediakeysystemconfiguration-persistentstate) */
4730+
persistentState?: string;
4731+
47294732
/** The session type (see https://www.w3.org/TR/encrypted-media/#dom-mediakeysessiontype) */
47304733
sessionType?: string;
47314734

@@ -4749,6 +4752,21 @@ export interface ProtectionData {
47494752
certType?: string;
47504753
url?: string
47514754
}>;
4755+
4756+
/** CDM-specific data passed during key system access request */
4757+
cdmData?: string;
4758+
4759+
/** Legacy/alternative license acquisition URL */
4760+
laURL?: string;
4761+
4762+
/** Flag indicating DRMToday vendor-specific handling */
4763+
drmtoday?: boolean;
4764+
4765+
/** Preferred key system string ordering */
4766+
systemStringPriority?: string[];
4767+
4768+
/** Initialization data types (e.g. "cenc", "sinf") */
4769+
initDataTypes?: string[];
47524770
}
47534771

47544772
export interface SessionToken {

package-lock.json

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

samples/dash-if-reference-player/app/js/DrmController.js

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,12 @@ export class DrmController {
104104
hasData = true;
105105
}
106106

107-
// DRM prioritization
108-
if (this._isChecked('drm-prioritize')) {
109-
const prPriority = parseInt($('#drm-pr-priority')?.value);
110-
const wvPriority = parseInt($('#drm-wv-priority')?.value);
111-
const fpPriority = parseInt($('#drm-fp-priority')?.value);
107+
// DRM prioritization — apply automatically if any priority has been adjusted
108+
const prPriority = parseInt($('#drm-pr-priority')?.value);
109+
const wvPriority = parseInt($('#drm-wv-priority')?.value);
110+
const fpPriority = parseInt($('#drm-fp-priority')?.value);
111+
const hasPriority = [prPriority, wvPriority, fpPriority].some(p => !isNaN(p) && p > 0);
112+
if (hasPriority) {
112113
if (protData['com.microsoft.playready'] && !isNaN(prPriority)) {
113114
protData['com.microsoft.playready'].priority = prPriority;
114115
}
@@ -142,6 +143,8 @@ export class DrmController {
142143
this._setVal('drm-pr-timeout', pr.httpTimeout);
143144
this._setVal('drm-pr-video-robustness', pr.videoRobustness);
144145
this._setVal('drm-pr-audio-robustness', pr.audioRobustness);
146+
this._setVal('drm-pr-persistent-state', pr.persistentState);
147+
this._setVal('drm-pr-distinctive-identifier', pr.distinctiveIdentifier);
145148
this._extractHeaders(pr.httpRequestHeaders, this._prHeaders, 'drm-pr-headers');
146149
this._applyPriority('drm-pr-priority', pr.priority);
147150
}
@@ -154,6 +157,8 @@ export class DrmController {
154157
this._setVal('drm-wv-timeout', wv.httpTimeout);
155158
this._setVal('drm-wv-video-robustness', wv.videoRobustness);
156159
this._setVal('drm-wv-audio-robustness', wv.audioRobustness);
160+
this._setVal('drm-wv-persistent-state', wv.persistentState);
161+
this._setVal('drm-wv-distinctive-identifier', wv.distinctiveIdentifier);
157162
this._extractHeaders(wv.httpRequestHeaders, this._wvHeaders, 'drm-wv-headers');
158163
this._applyPriority('drm-wv-priority', wv.priority);
159164
}
@@ -166,6 +171,8 @@ export class DrmController {
166171
this._setVal('drm-fp-timeout', fp.httpTimeout);
167172
this._setVal('drm-fp-video-robustness', fp.videoRobustness);
168173
this._setVal('drm-fp-audio-robustness', fp.audioRobustness);
174+
this._setVal('drm-fp-persistent-state', fp.persistentState);
175+
this._setVal('drm-fp-distinctive-identifier', fp.distinctiveIdentifier);
169176
this._extractHeaders(fp.httpRequestHeaders, this._fpHeaders, 'drm-fp-headers');
170177
this._applyPriority('drm-fp-priority', fp.priority);
171178
}
@@ -188,14 +195,7 @@ export class DrmController {
188195
this._extractHeaders(ck.httpRequestHeaders, this._ckHeaders, 'drm-ck-headers');
189196
}
190197

191-
// Enable DRM prioritization checkbox if any system has a priority set
192-
const hasPriority = [pr, wv, fp].some(d => d && d.priority !== undefined && d.priority !== null);
193-
if (hasPriority) {
194-
const prioritize = $('#drm-prioritize');
195-
if (prioritize) {
196-
prioritize.checked = true;
197-
}
198-
}
198+
199199
}
200200

201201
/**
@@ -215,7 +215,10 @@ export class DrmController {
215215
}
216216
}
217217

218-
const selects = ['drm-wv-video-robustness', 'drm-wv-audio-robustness'];
218+
const selects = ['drm-wv-video-robustness', 'drm-wv-audio-robustness',
219+
'drm-pr-persistent-state', 'drm-pr-distinctive-identifier',
220+
'drm-wv-persistent-state', 'drm-wv-distinctive-identifier',
221+
'drm-fp-persistent-state', 'drm-fp-distinctive-identifier'];
219222
for (const id of selects) {
220223
const el = $(`#${id}`);
221224
if (el) {
@@ -234,22 +237,13 @@ export class DrmController {
234237
this._renderHeaders('drm-ck-headers', this._ckHeaders);
235238
this._renderKeyPairs();
236239

237-
const prioritize = $('#drm-prioritize');
238-
if (prioritize) {
239-
prioritize.checked = false;
240-
}
241240
$('#drm-pr-priority').value = '0';
242241
$('#drm-wv-priority').value = '0';
243242
$('#drm-fp-priority').value = '0';
244243
}
245244

246245
// ---- Private ----
247246

248-
_isChecked(id) {
249-
const el = $(`#${id}`);
250-
return el ? el.checked : false;
251-
}
252-
253247
_setVal(id, value) {
254248
const el = $(`#${id}`);
255249
if (el && value !== undefined && value !== null) {
@@ -308,6 +302,16 @@ export class DrmController {
308302
target.audioRobustness = audioRobustness;
309303
}
310304

305+
const persistentState = $(`#drm-${prefix}-persistent-state`)?.value;
306+
if (persistentState) {
307+
target.persistentState = persistentState;
308+
}
309+
310+
const distinctiveIdentifier = $(`#drm-${prefix}-distinctive-identifier`)?.value;
311+
if (distinctiveIdentifier) {
312+
target.distinctiveIdentifier = distinctiveIdentifier;
313+
}
314+
311315
// Headers
312316
const headerArray = prefix === 'pr' ? this._prHeaders : prefix === 'wv' ? this._wvHeaders : this._fpHeaders;
313317
this._addHeaders(target, headerArray);

samples/dash-if-reference-player/index.html

Lines changed: 60 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,6 +848,26 @@ <h6 class="text-info">PlayReady</h6>
848848
placeholder="e.g. 3000">
849849
</div>
850850
</div>
851+
<div class="row mb-3">
852+
<div class="col-md-6">
853+
<label class="form-label small">Persistent State</label>
854+
<select class="form-select form-select-sm" id="drm-pr-persistent-state">
855+
<option value="">Default</option>
856+
<option value="required">required</option>
857+
<option value="optional">optional</option>
858+
<option value="not-allowed">not-allowed</option>
859+
</select>
860+
</div>
861+
<div class="col-md-6">
862+
<label class="form-label small">Distinctive Identifier</label>
863+
<select class="form-select form-select-sm" id="drm-pr-distinctive-identifier">
864+
<option value="">Default</option>
865+
<option value="required">required</option>
866+
<option value="optional">optional</option>
867+
<option value="not-allowed">not-allowed</option>
868+
</select>
869+
</div>
870+
</div>
851871
<div class="mb-3">
852872
<label class="form-label small">Request Headers</label>
853873
<div id="drm-pr-headers"></div>
@@ -893,6 +913,26 @@ <h6 class="text-info">Widevine</h6>
893913
</select>
894914
</div>
895915
</div>
916+
<div class="row mb-3">
917+
<div class="col-md-6">
918+
<label class="form-label small">Persistent State</label>
919+
<select class="form-select form-select-sm" id="drm-wv-persistent-state">
920+
<option value="">Default</option>
921+
<option value="required">required</option>
922+
<option value="optional">optional</option>
923+
<option value="not-allowed">not-allowed</option>
924+
</select>
925+
</div>
926+
<div class="col-md-6">
927+
<label class="form-label small">Distinctive Identifier</label>
928+
<select class="form-select form-select-sm" id="drm-wv-distinctive-identifier">
929+
<option value="">Default</option>
930+
<option value="required">required</option>
931+
<option value="optional">optional</option>
932+
<option value="not-allowed">not-allowed</option>
933+
</select>
934+
</div>
935+
</div>
896936
<div class="mb-3">
897937
<label class="form-label small">Request Headers</label>
898938
<div id="drm-wv-headers"></div>
@@ -924,6 +964,26 @@ <h6 class="text-info">FairPlay</h6>
924964
<input type="text" class="form-control form-control-sm" id="drm-fp-audio-robustness">
925965
</div>
926966
</div>
967+
<div class="row mb-3">
968+
<div class="col-md-6">
969+
<label class="form-label small">Persistent State</label>
970+
<select class="form-select form-select-sm" id="drm-fp-persistent-state">
971+
<option value="">Default</option>
972+
<option value="required">required</option>
973+
<option value="optional">optional</option>
974+
<option value="not-allowed">not-allowed</option>
975+
</select>
976+
</div>
977+
<div class="col-md-6">
978+
<label class="form-label small">Distinctive Identifier</label>
979+
<select class="form-select form-select-sm" id="drm-fp-distinctive-identifier">
980+
<option value="">Default</option>
981+
<option value="required">required</option>
982+
<option value="optional">optional</option>
983+
<option value="not-allowed">not-allowed</option>
984+
</select>
985+
</div>
986+
</div>
927987
<div class="mb-3">
928988
<label class="form-label small">Request Headers</label>
929989
<div id="drm-fp-headers"></div>
@@ -950,10 +1010,6 @@ <h6 class="text-info">ClearKey</h6>
9501010
</button>
9511011
</div>
9521012

953-
<div class="form-check mb-3">
954-
<input class="form-check-input" type="checkbox" id="drm-prioritize">
955-
<label class="form-check-label" for="drm-prioritize">Enable DRM Prioritization</label>
956-
</div>
9571013
</div>
9581014
<div class="modal-footer">
9591015
<button type="button" class="btn btn-primary" data-bs-dismiss="modal">Done</button>

0 commit comments

Comments
 (0)