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

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
@@ -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.10602"
133
+ "version": "1.5.14-0.canary.10603"
134
134
  }
@@ -20,6 +20,7 @@ import {
20
20
  parseInitSegment,
21
21
  RemuxerTrackIdConfig,
22
22
  hasMoofData,
23
+ IEmsgParsingData,
23
24
  } from '../utils/mp4-tools';
24
25
  import { dummyTrack } from './dummy-demuxed-track';
25
26
  import type { HlsEventEmitter } from '../events';
@@ -155,10 +156,7 @@ class MP4Demuxer implements Demuxer {
155
156
  emsgs.forEach((data: Uint8Array) => {
156
157
  const emsgInfo = parseEmsg(data);
157
158
  if (emsgSchemePattern.test(emsgInfo.schemeIdUri)) {
158
- const pts = Number.isFinite(emsgInfo.presentationTime)
159
- ? emsgInfo.presentationTime! / emsgInfo.timeScale
160
- : timeOffset +
161
- emsgInfo.presentationTimeDelta! / emsgInfo.timeScale;
159
+ const pts = getEmsgStartTime(emsgInfo, timeOffset);
162
160
  let duration =
163
161
  emsgInfo.eventDuration === 0xffffffff
164
162
  ? Number.POSITIVE_INFINITY
@@ -180,11 +178,7 @@ class MP4Demuxer implements Demuxer {
180
178
  this.config.enableEmsgKLVMetadata &&
181
179
  emsgInfo.schemeIdUri.startsWith('urn:misb:KLV:bin:1910.1')
182
180
  ) {
183
- const pts = Number.isFinite(emsgInfo.presentationTime)
184
- ? emsgInfo.presentationTime! / emsgInfo.timeScale
185
- : timeOffset +
186
- emsgInfo.presentationTimeDelta! / emsgInfo.timeScale;
187
-
181
+ const pts = getEmsgStartTime(emsgInfo, timeOffset);
188
182
  id3Track.samples.push({
189
183
  data: emsgInfo.payload,
190
184
  len: emsgInfo.payload.byteLength,
@@ -222,4 +216,14 @@ class MP4Demuxer implements Demuxer {
222
216
  }
223
217
  }
224
218
 
219
+ function getEmsgStartTime(
220
+ emsgInfo: IEmsgParsingData,
221
+ timeOffset: number,
222
+ ): number {
223
+ return Number.isFinite(emsgInfo.presentationTime)
224
+ ? (emsgInfo.presentationTime as number) / emsgInfo.timeScale
225
+ : timeOffset +
226
+ (emsgInfo.presentationTimeDelta as number) / emsgInfo.timeScale;
227
+ }
228
+
225
229
  export default MP4Demuxer;