hls.js 1.5.14-0.canary.10598 → 1.5.14-0.canary.10602

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/package.json CHANGED
@@ -111,7 +111,7 @@
111
111
  "karma-rollup-preprocessor": "github:jlmakes/karma-rollup-preprocessor#7a7268d91149307b3cf2888ee4e65ccd079955a3",
112
112
  "karma-sinon-chai": "2.0.2",
113
113
  "karma-sourcemap-loader": "0.4.0",
114
- "lint-staged": "15.2.9",
114
+ "lint-staged": "15.2.10",
115
115
  "markdown-styles": "3.2.0",
116
116
  "micromatch": "4.0.8",
117
117
  "mocha": "10.7.3",
@@ -130,5 +130,5 @@
130
130
  "url-toolkit": "2.2.5",
131
131
  "wrangler": "3.75.0"
132
132
  },
133
- "version": "1.5.14-0.canary.10598"
133
+ "version": "1.5.14-0.canary.10602"
134
134
  }
package/src/config.ts CHANGED
@@ -241,6 +241,7 @@ export type LatencyControllerConfig = {
241
241
  export type MetadataControllerConfig = {
242
242
  enableDateRangeMetadataCues: boolean;
243
243
  enableEmsgMetadataCues: boolean;
244
+ enableEmsgKLVMetadata: boolean;
244
245
  enableID3MetadataCues: boolean;
245
246
  };
246
247
 
@@ -412,6 +413,7 @@ export const hlsDefaultConfig: HlsConfig = {
412
413
  cmcd: undefined,
413
414
  enableDateRangeMetadataCues: true,
414
415
  enableEmsgMetadataCues: true,
416
+ enableEmsgKLVMetadata: false,
415
417
  enableID3MetadataCues: true,
416
418
  useMediaCapabilities: __USE_MEDIA_CAPABILITIES__,
417
419
 
@@ -115,7 +115,6 @@ class MP4Demuxer implements Demuxer {
115
115
  } else {
116
116
  videoTrack.samples = videoSamples;
117
117
  }
118
-
119
118
  const id3Track = this.extractID3Track(videoTrack, timeOffset);
120
119
  textTrack.samples = parseSamples(timeOffset, videoTrack);
121
120
 
@@ -177,6 +176,23 @@ class MP4Demuxer implements Demuxer {
177
176
  type: MetadataSchema.emsg,
178
177
  duration: duration,
179
178
  });
179
+ } else if (
180
+ this.config.enableEmsgKLVMetadata &&
181
+ emsgInfo.schemeIdUri.startsWith('urn:misb:KLV:bin:1910.1')
182
+ ) {
183
+ const pts = Number.isFinite(emsgInfo.presentationTime)
184
+ ? emsgInfo.presentationTime! / emsgInfo.timeScale
185
+ : timeOffset +
186
+ emsgInfo.presentationTimeDelta! / emsgInfo.timeScale;
187
+
188
+ id3Track.samples.push({
189
+ data: emsgInfo.payload,
190
+ len: emsgInfo.payload.byteLength,
191
+ dts: pts,
192
+ pts: pts,
193
+ type: MetadataSchema.misbklv,
194
+ duration: Number.POSITIVE_INFINITY,
195
+ });
180
196
  }
181
197
  });
182
198
  }
package/src/hls.ts CHANGED
@@ -12,6 +12,7 @@ import { enableLogs, type ILogger } from './utils/logger';
12
12
  import { enableStreamingMode, hlsDefaultConfig, mergeConfig } from './config';
13
13
  import { EventEmitter } from 'eventemitter3';
14
14
  import { Events } from './events';
15
+ import { MetadataSchema } from './types/demuxer';
15
16
  import { ErrorTypes, ErrorDetails } from './errors';
16
17
  import { version } from './version';
17
18
  import { isHdcpLevel, type HdcpLevel, type Level } from './types/level';
@@ -116,6 +117,10 @@ export default class Hls implements HlsEventEmitter {
116
117
  return Events;
117
118
  }
118
119
 
120
+ static get MetadataSchema(): typeof MetadataSchema {
121
+ return MetadataSchema;
122
+ }
123
+
119
124
  static get ErrorTypes(): typeof ErrorTypes {
120
125
  return ErrorTypes;
121
126
  }
@@ -1026,6 +1031,7 @@ export type {
1026
1031
  ErrorDetails,
1027
1032
  ErrorTypes,
1028
1033
  Events,
1034
+ MetadataSchema,
1029
1035
  Level,
1030
1036
  HlsListeners,
1031
1037
  HlsEventEmitter,
@@ -1097,11 +1103,7 @@ export type { LoadStats } from './loader/load-stats';
1097
1103
  export type { LevelKey } from './loader/level-key';
1098
1104
  export type { LevelDetails } from './loader/level-details';
1099
1105
  export type { SourceBufferName } from './types/buffer';
1100
- export type {
1101
- MetadataSample,
1102
- MetadataSchema,
1103
- UserdataSample,
1104
- } from './types/demuxer';
1106
+ export type { MetadataSample, UserdataSample } from './types/demuxer';
1105
1107
  export type {
1106
1108
  HlsSkip,
1107
1109
  HlsUrlParameters,
@@ -95,10 +95,11 @@ export interface DemuxedUserdataTrack extends DemuxedTrack {
95
95
  samples: UserdataSample[];
96
96
  }
97
97
 
98
- export const enum MetadataSchema {
98
+ export enum MetadataSchema {
99
99
  audioId3 = 'org.id3',
100
100
  dateRange = 'com.apple.quicktime.HLS',
101
101
  emsg = 'https://aomedia.org/emsg/ID3',
102
+ misbklv = 'urn:misb:KLV:bin:1910.1',
102
103
  }
103
104
  export interface MetadataSample {
104
105
  pts: number;