hls.js 1.6.0-beta.2.0.canary.10869 → 1.6.0-beta.2.0.canary.10873
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.js +50 -42
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +24 -19
- 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 +24 -19
- 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 +47 -39
- package/dist/hls.mjs.map +1 -1
- package/dist/hls.worker.js +1 -1
- package/dist/hls.worker.js.map +1 -1
- package/package.json +1 -1
- package/src/demux/video/hevc-video-parser.ts +34 -25
- package/src/utils/fetch-loader.ts +12 -8
- package/src/utils/xhr-loader.ts +4 -11
package/package.json
CHANGED
@@ -122,8 +122,10 @@ class HevcVideoParser extends BaseVideoParser {
|
|
122
122
|
case 32:
|
123
123
|
push = true;
|
124
124
|
if (!track.vps) {
|
125
|
-
|
126
|
-
|
125
|
+
if (typeof track.params !== 'object') {
|
126
|
+
track.params = {};
|
127
|
+
}
|
128
|
+
track.params = Object.assign(track.params, this.readVPS(unit.data));
|
127
129
|
this.initVPS = unit.data;
|
128
130
|
}
|
129
131
|
track.vps = [unit.data];
|
@@ -133,31 +135,35 @@ class HevcVideoParser extends BaseVideoParser {
|
|
133
135
|
case 33:
|
134
136
|
push = true;
|
135
137
|
spsfound = true;
|
136
|
-
if (
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
track.params[prop] = config.params[prop];
|
155
|
-
}
|
138
|
+
if (
|
139
|
+
track.vps !== undefined &&
|
140
|
+
track.vps[0] !== this.initVPS &&
|
141
|
+
track.sps !== undefined &&
|
142
|
+
!this.matchSPS(track.sps[0], unit.data)
|
143
|
+
) {
|
144
|
+
this.initVPS = track.vps[0];
|
145
|
+
track.sps = track.pps = undefined;
|
146
|
+
}
|
147
|
+
if (!track.sps) {
|
148
|
+
const config = this.readSPS(unit.data);
|
149
|
+
track.width = config.width;
|
150
|
+
track.height = config.height;
|
151
|
+
track.pixelRatio = config.pixelRatio;
|
152
|
+
track.codec = config.codecString;
|
153
|
+
track.sps = [];
|
154
|
+
if (typeof track.params !== 'object') {
|
155
|
+
track.params = {};
|
156
156
|
}
|
157
|
-
|
158
|
-
track.
|
157
|
+
for (const prop in config.params) {
|
158
|
+
track.params[prop] = config.params[prop];
|
159
159
|
}
|
160
160
|
}
|
161
|
+
if (
|
162
|
+
(!track.vps && !track.sps.length) ||
|
163
|
+
(track.vps && track.vps[0] === this.initVPS)
|
164
|
+
) {
|
165
|
+
track.sps.push(unit.data);
|
166
|
+
}
|
161
167
|
if (!VideoSample) {
|
162
168
|
VideoSample = this.VideoSample = this.createVideoSample(
|
163
169
|
true,
|
@@ -179,7 +185,10 @@ class HevcVideoParser extends BaseVideoParser {
|
|
179
185
|
track.params[prop] = config[prop];
|
180
186
|
}
|
181
187
|
}
|
182
|
-
if (
|
188
|
+
if (
|
189
|
+
(!track.vps && !track.pps.length) ||
|
190
|
+
(track.vps && track.vps[0] === this.initVPS)
|
191
|
+
) {
|
183
192
|
track.pps.push(unit.data);
|
184
193
|
}
|
185
194
|
}
|
@@ -93,8 +93,6 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
93
93
|
stats.loading.start = self.performance.now();
|
94
94
|
|
95
95
|
const initParams = getRequestParameters(context, this.controller.signal);
|
96
|
-
const onProgress: LoaderOnProgress<LoaderContext> | undefined =
|
97
|
-
callbacks.onProgress;
|
98
96
|
const isArrayBuffer = context.responseType === 'arraybuffer';
|
99
97
|
const LENGTH = isArrayBuffer ? 'byteLength' : 'length';
|
100
98
|
const { maxTimeToFirstByteMs, maxLoadTimeMs } = config.loadPolicy;
|
@@ -109,8 +107,10 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
109
107
|
? maxTimeToFirstByteMs
|
110
108
|
: maxLoadTimeMs;
|
111
109
|
this.requestTimeout = self.setTimeout(() => {
|
112
|
-
this.
|
113
|
-
|
110
|
+
if (this.callbacks) {
|
111
|
+
this.abortInternal();
|
112
|
+
this.callbacks.onTimeout(stats, context, this.response);
|
113
|
+
}
|
114
114
|
}, config.timeout);
|
115
115
|
|
116
116
|
const fetchPromise = isPromise(this.request)
|
@@ -127,8 +127,10 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
127
127
|
config.timeout = maxLoadTimeMs;
|
128
128
|
this.requestTimeout = self.setTimeout(
|
129
129
|
() => {
|
130
|
-
this.
|
131
|
-
|
130
|
+
if (this.callbacks) {
|
131
|
+
this.abortInternal();
|
132
|
+
this.callbacks.onTimeout(stats, context, this.response);
|
133
|
+
}
|
132
134
|
},
|
133
135
|
maxLoadTimeMs - (first - stats.loading.start),
|
134
136
|
);
|
@@ -145,6 +147,7 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
145
147
|
|
146
148
|
stats.total = getContentLength(response.headers) || stats.total;
|
147
149
|
|
150
|
+
const onProgress = this.callbacks?.onProgress;
|
148
151
|
if (onProgress && Number.isFinite(config.highWaterMark)) {
|
149
152
|
return this.loadProgressively(
|
150
153
|
response,
|
@@ -184,11 +187,12 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
184
187
|
code: response.status,
|
185
188
|
};
|
186
189
|
|
190
|
+
const onProgress = this.callbacks?.onProgress;
|
187
191
|
if (onProgress && !Number.isFinite(config.highWaterMark)) {
|
188
192
|
onProgress(stats, context, responseData, response);
|
189
193
|
}
|
190
194
|
|
191
|
-
callbacks
|
195
|
+
this.callbacks?.onSuccess(loaderResponse, stats, context, response);
|
192
196
|
})
|
193
197
|
.catch((error) => {
|
194
198
|
self.clearTimeout(this.requestTimeout);
|
@@ -199,7 +203,7 @@ class FetchLoader implements Loader<LoaderContext> {
|
|
199
203
|
// when destroying, 'error' itself can be undefined
|
200
204
|
const code: number = !error ? 0 : error.code || 0;
|
201
205
|
const text: string = !error ? null : error.message;
|
202
|
-
callbacks
|
206
|
+
this.callbacks?.onError(
|
203
207
|
{ code, text },
|
204
208
|
context,
|
205
209
|
error ? error.details : null,
|
package/src/utils/xhr-loader.ts
CHANGED
@@ -113,7 +113,7 @@ class XhrLoader implements Loader<LoaderContext> {
|
|
113
113
|
})
|
114
114
|
.catch((error: Error) => {
|
115
115
|
// IE11 throws an exception on xhr.open if attempting to access an HTTP resource over HTTPS
|
116
|
-
this.callbacks
|
116
|
+
this.callbacks?.onError(
|
117
117
|
{ code: xhr.status, text: error.message },
|
118
118
|
context,
|
119
119
|
xhr,
|
@@ -220,23 +220,16 @@ class XhrLoader implements Loader<LoaderContext> {
|
|
220
220
|
stats.loaded = stats.total = len;
|
221
221
|
stats.bwEstimate =
|
222
222
|
(stats.total * 8000) / (stats.loading.end - stats.loading.first);
|
223
|
-
|
224
|
-
return;
|
225
|
-
}
|
226
|
-
const onProgress = this.callbacks.onProgress;
|
223
|
+
const onProgress = this.callbacks?.onProgress;
|
227
224
|
if (onProgress) {
|
228
225
|
onProgress(stats, context, data, xhr);
|
229
226
|
}
|
230
|
-
if (!this.callbacks) {
|
231
|
-
return;
|
232
|
-
}
|
233
227
|
const response: LoaderResponse = {
|
234
228
|
url: xhr.responseURL,
|
235
229
|
data: data,
|
236
230
|
code: status,
|
237
231
|
};
|
238
|
-
|
239
|
-
this.callbacks.onSuccess(response, stats, context, xhr);
|
232
|
+
this.callbacks?.onSuccess(response, stats, context, xhr);
|
240
233
|
return;
|
241
234
|
}
|
242
235
|
}
|
@@ -254,7 +247,7 @@ class XhrLoader implements Loader<LoaderContext> {
|
|
254
247
|
this.retry(retryConfig);
|
255
248
|
} else {
|
256
249
|
logger.error(`${status} while loading ${context.url}`);
|
257
|
-
this.callbacks
|
250
|
+
this.callbacks?.onError(
|
258
251
|
{ code: status, text: xhr.statusText },
|
259
252
|
context,
|
260
253
|
xhr,
|