hls.js 1.5.14-0.canary.10596 → 1.5.14-0.canary.10601

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/README.md CHANGED
@@ -393,6 +393,28 @@ To check for native browser support first and then fallback to HLS.js, swap thes
393
393
  </script>
394
394
  ```
395
395
 
396
+ #### Ensure correct time in video
397
+
398
+ HLS transcoding of an original video file often pushes the time of the first frame a bit. If you depend on having an exact match of frame times between original video and HLS stream, you need to account for this:
399
+
400
+ ```javascript
401
+ let tOffset = 0;
402
+ const getAppendedOffset = (eventName, { frag }) => {
403
+ if (frag.type === 'main' && frag.sn !== 'initSegment' && frag.elementaryStreams.video) {
404
+ const { start, startDTS, startPTS, maxStartPTS, elementaryStreams } = frag;
405
+ tOffset = elementaryStreams.video.startPTS - start;
406
+ hls.off(Hls.Events.BUFFER_APPENDED, getAppendedOffset);
407
+ console.log('video timestamp offset:', tOffset, { start, startDTS, startPTS, maxStartPTS, elementaryStreams });
408
+ }
409
+ }
410
+ hls.on(Hls.Events.BUFFER_APPENDED, getAppendedOffset);
411
+ // and account for this offset, for example like this:
412
+ const video = document.querySelector('video');
413
+ video.addEventListener('timeupdate', () => setTime(Math.max(0, video.currentTime - tOffset))
414
+ const seek = (t) => video.currentTime = t + tOffset;
415
+ const getDuration = () => video.duration - tOffset;
416
+ ```
417
+
396
418
  For more embed and API examples see [docs/API.md](./docs/API.md).
397
419
 
398
420
  ## CORS
package/dist/hls.js CHANGED
@@ -523,7 +523,7 @@
523
523
  // Some browsers don't allow to use bind on console object anyway
524
524
  // fallback to default if needed
525
525
  try {
526
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.10596");
526
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.10601");
527
527
  } catch (e) {
528
528
  /* log fn threw an exception. All logger methods are no-ops. */
529
529
  return createLogger();
@@ -17311,7 +17311,7 @@
17311
17311
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
17312
17312
  }
17313
17313
 
17314
- var version = "1.5.14-0.canary.10596";
17314
+ var version = "1.5.14-0.canary.10601";
17315
17315
 
17316
17316
  // ensure the worker ends up in the bundle
17317
17317
  // If the worker should not be included this gets aliased to empty.js
package/dist/hls.light.js CHANGED
@@ -494,7 +494,7 @@
494
494
  // Some browsers don't allow to use bind on console object anyway
495
495
  // fallback to default if needed
496
496
  try {
497
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.10596");
497
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.14-0.canary.10601");
498
498
  } catch (e) {
499
499
  /* log fn threw an exception. All logger methods are no-ops. */
500
500
  return createLogger();
@@ -19284,7 +19284,7 @@
19284
19284
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
19285
19285
  }
19286
19286
 
19287
- var version = "1.5.14-0.canary.10596";
19287
+ var version = "1.5.14-0.canary.10601";
19288
19288
 
19289
19289
  // ensure the worker ends up in the bundle
19290
19290
  // If the worker should not be included this gets aliased to empty.js