hls.js 1.5.13-0.canary.10408 → 1.5.13-0.canary.10411

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 CHANGED
@@ -522,7 +522,7 @@
522
522
  // Some browsers don't allow to use bind on console object anyway
523
523
  // fallback to default if needed
524
524
  try {
525
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.13-0.canary.10408");
525
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.5.13-0.canary.10411");
526
526
  } catch (e) {
527
527
  /* log fn threw an exception. All logger methods are no-ops. */
528
528
  return createLogger();
@@ -3116,14 +3116,18 @@
3116
3116
  }
3117
3117
  function convertAVC1ToAVCOTI(codec) {
3118
3118
  // Convert avc1 codec string from RFC-4281 to RFC-6381 for MediaSource.isTypeSupported
3119
- var avcdata = codec.split('.');
3120
- if (avcdata.length > 2) {
3121
- var result = avcdata.shift() + '.';
3122
- result += parseInt(avcdata.shift()).toString(16);
3123
- result += ('000' + parseInt(avcdata.shift()).toString(16)).slice(-4);
3124
- return result;
3119
+ // Examples: avc1.66.30 to avc1.42001e and avc1.77.30,avc1.66.30 to avc1.4d001e,avc1.42001e.
3120
+ var codecs = codec.split(',');
3121
+ for (var i = 0; i < codecs.length; i++) {
3122
+ var avcdata = codecs[i].split('.');
3123
+ if (avcdata.length > 2) {
3124
+ var result = avcdata.shift() + '.';
3125
+ result += parseInt(avcdata.shift()).toString(16);
3126
+ result += ('000' + parseInt(avcdata.shift()).toString(16)).slice(-4);
3127
+ codecs[i] = result;
3128
+ }
3125
3129
  }
3126
- return codec;
3130
+ return codecs.join(',');
3127
3131
  }
3128
3132
  function getM2TSSupportedAudioTypes(preferManagedMediaSource) {
3129
3133
  var MediaSource = getMediaSource(preferManagedMediaSource) || {
@@ -16135,40 +16139,6 @@
16135
16139
  this.isAudioContiguous = true;
16136
16140
  return audioData;
16137
16141
  };
16138
- _proto.remuxEmptyAudio = function remuxEmptyAudio(track, timeOffset, contiguous, videoData) {
16139
- var inputTimeScale = track.inputTimeScale;
16140
- var mp4timeScale = track.samplerate ? track.samplerate : inputTimeScale;
16141
- var scaleFactor = inputTimeScale / mp4timeScale;
16142
- var nextAudioPts = this.nextAudioPts;
16143
- // sync with video's timestamp
16144
- var initDTS = this._initDTS;
16145
- var init90kHz = initDTS.baseTime * 90000 / initDTS.timescale;
16146
- var startDTS = (nextAudioPts !== null ? nextAudioPts : videoData.startDTS * inputTimeScale) + init90kHz;
16147
- var endDTS = videoData.endDTS * inputTimeScale + init90kHz;
16148
- // one sample's duration value
16149
- var frameDuration = scaleFactor * AAC_SAMPLES_PER_FRAME;
16150
- // samples count of this segment's duration
16151
- var nbSamples = Math.ceil((endDTS - startDTS) / frameDuration);
16152
- // silent frame
16153
- var silentFrame = AAC.getSilentFrame(track.parsedCodec || track.manifestCodec || track.codec, track.channelCount);
16154
- logger.warn('[mp4-remuxer]: remux empty Audio');
16155
- // Can't remux if we can't generate a silent frame...
16156
- if (!silentFrame) {
16157
- logger.trace('[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec');
16158
- return;
16159
- }
16160
- var samples = [];
16161
- for (var i = 0; i < nbSamples; i++) {
16162
- var stamp = startDTS + i * frameDuration;
16163
- samples.push({
16164
- unit: silentFrame,
16165
- pts: stamp,
16166
- dts: stamp
16167
- });
16168
- }
16169
- track.samples = samples;
16170
- return this.remuxAudio(track, timeOffset, contiguous, false);
16171
- };
16172
16142
  return MP4Remuxer;
16173
16143
  }();
16174
16144
  function normalizePts(value, reference) {
@@ -17877,6 +17847,7 @@
17877
17847
  this.lastCurrentTime = media.currentTime;
17878
17848
  };
17879
17849
  _proto.doTickIdle = function doTickIdle() {
17850
+ var _this$mainFragLoading;
17880
17851
  var hls = this.hls,
17881
17852
  levels = this.levels,
17882
17853
  media = this.media,
@@ -17951,12 +17922,24 @@
17951
17922
  this.bufferFlushed = true;
17952
17923
  return;
17953
17924
  }
17954
- if (this.startFragRequested && (!trackDetails.live || targetBufferTime < this.hls.liveSyncPosition)) {
17955
- // Request audio segments up to one fragment ahead of main buffer
17956
- var mainFragLoading = this.mainFragLoading;
17957
- var mainTargetBufferEnd = mainFragLoading ? (mainFragLoading.part || mainFragLoading.frag).end : null;
17958
- var atBufferSyncLimit = mainTargetBufferEnd !== null && frag.start > mainTargetBufferEnd;
17959
- if (atBufferSyncLimit && !frag.endList) {
17925
+
17926
+ // Request audio segments up to one fragment ahead of main stream-controller
17927
+ var mainFragLoading = (_this$mainFragLoading = this.mainFragLoading) == null ? void 0 : _this$mainFragLoading.frag;
17928
+ if (this.startFragRequested && mainFragLoading && mainFragLoading.sn !== 'initSegment' && frag.sn !== 'initSegment' && !frag.endList && (!trackDetails.live || !this.loadingParts && targetBufferTime < this.hls.liveSyncPosition)) {
17929
+ var mainFrag = mainFragLoading;
17930
+ if (frag.start > mainFrag.end) {
17931
+ // Get buffered frag at target position from tracker (loaded out of sequence)
17932
+ var mainFragAtPos = this.fragmentTracker.getFragAtPos(targetBufferTime, PlaylistLevelType.MAIN);
17933
+ if (mainFragAtPos && mainFragAtPos.end > mainFragLoading.end) {
17934
+ mainFrag = mainFragAtPos;
17935
+ this.mainFragLoading = {
17936
+ frag: mainFragAtPos,
17937
+ targetBufferTime: null
17938
+ };
17939
+ }
17940
+ }
17941
+ var atBufferSyncLimit = frag.start > mainFrag.end;
17942
+ if (atBufferSyncLimit) {
17960
17943
  return;
17961
17944
  }
17962
17945
  }
@@ -30805,7 +30788,7 @@
30805
30788
  * Get the video-dev/hls.js package version.
30806
30789
  */
30807
30790
  function get() {
30808
- return "1.5.13-0.canary.10408";
30791
+ return "1.5.13-0.canary.10411";
30809
30792
  }
30810
30793
  }, {
30811
30794
  key: "Events",
package/dist/hls.js.d.ts CHANGED
@@ -253,7 +253,7 @@ export declare class BaseStreamController extends TaskLoop implements NetworkCom
253
253
  protected decrypter: Decrypter;
254
254
  protected initPTS: RationalTimestamp[];
255
255
  protected buffering: boolean;
256
- private loadingParts;
256
+ protected loadingParts: boolean;
257
257
  private loopSn?;
258
258
  constructor(hls: Hls, fragmentTracker: FragmentTracker, keyLoader: KeyLoader, logPrefix: string, playlistType: PlaylistLevelType);
259
259
  protected registerListeners(): void;