hls.js 1.6.0-rc.1.0.canary.11077 → 1.6.0-rc.1.0.canary.11078
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 +25 -12
- package/dist/hls.js.map +1 -1
- package/dist/hls.light.js +25 -12
- 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 +25 -12
- 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 +25 -12
- 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/utils/mp4-tools.ts +28 -10
package/package.json
CHANGED
package/src/utils/mp4-tools.ts
CHANGED
@@ -226,13 +226,24 @@ export interface InitDataTrack {
|
|
226
226
|
supplemental: string | undefined;
|
227
227
|
}
|
228
228
|
|
229
|
-
type
|
229
|
+
type HdlrMetadata = 'meta';
|
230
|
+
type HdlrType =
|
231
|
+
| ElementaryStreamTypes.AUDIO
|
232
|
+
| ElementaryStreamTypes.VIDEO
|
233
|
+
| HdlrMetadata;
|
234
|
+
|
235
|
+
type StsdData = {
|
236
|
+
codec: string;
|
237
|
+
encrypted: boolean;
|
238
|
+
supplemental: string | undefined;
|
239
|
+
};
|
230
240
|
|
231
241
|
export interface InitData extends Array<any> {
|
232
242
|
[index: number]:
|
233
243
|
| {
|
234
244
|
timescale: number;
|
235
245
|
type: HdlrType;
|
246
|
+
stsd: StsdData;
|
236
247
|
default?: {
|
237
248
|
duration: number;
|
238
249
|
flags: number;
|
@@ -266,10 +277,20 @@ export function parseInitSegment(initSegment: Uint8Array): InitData {
|
|
266
277
|
}[hdlrType];
|
267
278
|
if (type) {
|
268
279
|
// Parse codec details
|
269
|
-
const
|
270
|
-
const
|
271
|
-
|
272
|
-
|
280
|
+
const stsdBox = findBox(trak, ['mdia', 'minf', 'stbl', 'stsd'])[0];
|
281
|
+
const stsd = parseStsd(stsdBox);
|
282
|
+
if (type) {
|
283
|
+
// Add 'audio', 'video', and 'audiovideo' track records that will map to SourceBuffers
|
284
|
+
result[trackId] = { timescale, type, stsd };
|
285
|
+
result[type] = { timescale, id: trackId, ...stsd };
|
286
|
+
} else {
|
287
|
+
// Add 'meta' and other track records required by `offsetStartDTS`
|
288
|
+
result[trackId] = {
|
289
|
+
timescale,
|
290
|
+
type: hdlrType as HdlrType,
|
291
|
+
stsd,
|
292
|
+
};
|
293
|
+
}
|
273
294
|
}
|
274
295
|
}
|
275
296
|
}
|
@@ -291,11 +312,7 @@ export function parseInitSegment(initSegment: Uint8Array): InitData {
|
|
291
312
|
return result;
|
292
313
|
}
|
293
314
|
|
294
|
-
function parseStsd(stsd: Uint8Array): {
|
295
|
-
codec: string;
|
296
|
-
encrypted: boolean;
|
297
|
-
supplemental: string | undefined;
|
298
|
-
} {
|
315
|
+
function parseStsd(stsd: Uint8Array): StsdData {
|
299
316
|
const sampleEntries = stsd.subarray(8);
|
300
317
|
const sampleEntriesEnd = sampleEntries.subarray(8 + 78);
|
301
318
|
const fourCC = bin2str(sampleEntries.subarray(4, 8));
|
@@ -818,6 +835,7 @@ export function computeRawDurationFromSamples(trun): number {
|
|
818
835
|
return duration;
|
819
836
|
}
|
820
837
|
|
838
|
+
// TODO: Remove `offsetStartDTS` in favor of using `timestampOffset` (issue #5715)
|
821
839
|
export function offsetStartDTS(
|
822
840
|
initData: InitData,
|
823
841
|
fmp4: Uint8Array,
|