hls.js 1.6.7-0.canary.11369 → 1.6.7-0.canary.11371
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hls.d.mts +1 -1
- package/dist/hls.d.ts +1 -1
- package/dist/hls.js +16 -15
- package/dist/hls.js.d.ts +1 -1
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +16 -15
- package/dist/hls.light.js.map +1 -1
- package/dist/hls.light.min.js +1 -1
- package/dist/hls.light.min.js.map +1 -1
- package/dist/hls.light.mjs +16 -17
- package/dist/hls.light.mjs.map +1 -1
- package/dist/hls.min.js +1 -1
- package/dist/hls.min.js.map +1 -1
- package/dist/hls.mjs +16 -17
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/package.json +1 -1
- package/src/controller/base-stream-controller.ts +1 -0
- package/src/loader/key-loader.ts +19 -16
package/src/loader/key-loader.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import { LoadError } from './fragment-loader';
|
2
2
|
import { ErrorDetails, ErrorTypes } from '../errors';
|
3
|
+
import { type Fragment, isMediaFragment } from '../loader/fragment';
|
3
4
|
import {
|
4
5
|
getKeySystemsForConfig,
|
5
6
|
keySystemFormatToKeySystemDomain,
|
@@ -8,7 +9,6 @@ import type { LevelKey } from './level-key';
|
|
8
9
|
import type { HlsConfig } from '../config';
|
9
10
|
import type EMEController from '../controller/eme-controller';
|
10
11
|
import type { MediaKeySessionContext } from '../controller/eme-controller';
|
11
|
-
import type { Fragment } from '../loader/fragment';
|
12
12
|
import type { ComponentAPI } from '../types/component-api';
|
13
13
|
import type { KeyLoadedData } from '../types/events';
|
14
14
|
import type {
|
@@ -94,39 +94,42 @@ export default class KeyLoader implements ComponentAPI {
|
|
94
94
|
loadClear(
|
95
95
|
loadingFrag: Fragment,
|
96
96
|
encryptedFragments: Fragment[],
|
97
|
+
startFragRequested: boolean,
|
97
98
|
): null | Promise<void> {
|
98
99
|
if (
|
99
100
|
this.emeController &&
|
100
101
|
this.config.emeEnabled &&
|
101
102
|
!this.emeController.getSelectedKeySystemFormats().length
|
102
103
|
) {
|
103
|
-
//
|
104
|
+
// Access key-system with nearest key on start (loading frag is unencrypted)
|
104
105
|
if (encryptedFragments.length) {
|
105
|
-
|
106
|
-
for (let i = 0; i < encryptedFragments.length; i++) {
|
106
|
+
for (let i = 0, l = encryptedFragments.length; i < l; i++) {
|
107
107
|
const frag = encryptedFragments[i];
|
108
|
+
// Loading at or before segment with EXT-X-KEY, or first frag loading and last EXT-X-KEY
|
108
109
|
if (
|
109
|
-
cc <= frag.cc &&
|
110
|
-
|
110
|
+
(loadingFrag.cc <= frag.cc &&
|
111
|
+
(!isMediaFragment(loadingFrag) ||
|
112
|
+
!isMediaFragment(frag) ||
|
113
|
+
loadingFrag.sn < frag.sn)) ||
|
114
|
+
(!startFragRequested && i == l - 1)
|
111
115
|
) {
|
112
116
|
return this.emeController
|
113
117
|
.selectKeySystemFormat(frag)
|
114
118
|
.then((keySystemFormat) => {
|
119
|
+
if (!this.emeController) {
|
120
|
+
return;
|
121
|
+
}
|
115
122
|
frag.setKeyFormat(keySystemFormat);
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
const keySystem =
|
121
|
-
keySystemFormatToKeySystemDomain(keySystemFormat);
|
122
|
-
if (keySystem) {
|
123
|
-
return this.emeController.getKeySystemAccess([keySystem]);
|
124
|
-
}
|
123
|
+
const keySystem =
|
124
|
+
keySystemFormatToKeySystemDomain(keySystemFormat);
|
125
|
+
if (keySystem) {
|
126
|
+
return this.emeController.getKeySystemAccess([keySystem]);
|
125
127
|
}
|
126
128
|
});
|
127
129
|
}
|
128
130
|
}
|
129
|
-
}
|
131
|
+
}
|
132
|
+
if (this.config.requireKeySystemAccessOnStart) {
|
130
133
|
const keySystemsInConfig = getKeySystemsForConfig(this.config);
|
131
134
|
if (keySystemsInConfig.length) {
|
132
135
|
return this.emeController.getKeySystemAccess(keySystemsInConfig);
|