hls.js 1.5.13-0.canary.10406 → 1.5.13-0.canary.10410

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.62.0"
132
132
  },
133
- "version": "1.5.13-0.canary.10406"
133
+ "version": "1.5.13-0.canary.10410"
134
134
  }
package/src/hls.ts CHANGED
@@ -80,7 +80,7 @@ export default class Hls implements HlsEventEmitter {
80
80
  private emeController: EMEController;
81
81
  private cmcdController: CMCDController;
82
82
  private _media: HTMLMediaElement | null = null;
83
- private url: string | null = null;
83
+ private _url: string | null = null;
84
84
  private triggeringException?: boolean;
85
85
 
86
86
  /**
@@ -370,7 +370,7 @@ export default class Hls implements HlsEventEmitter {
370
370
  this.detachMedia();
371
371
  this.removeAllListeners();
372
372
  this._autoLevelCapping = -1;
373
- this.url = null;
373
+ this._url = null;
374
374
 
375
375
  this.networkControllers.forEach((component) => component.destroy());
376
376
  this.networkControllers.length = 0;
@@ -408,8 +408,8 @@ export default class Hls implements HlsEventEmitter {
408
408
  loadSource(url: string) {
409
409
  this.stopLoad();
410
410
  const media = this.media;
411
- const loadedSource = this.url;
412
- const loadingSource = (this.url = buildAbsoluteURL(
411
+ const loadedSource = this._url;
412
+ const loadingSource = (this._url = buildAbsoluteURL(
413
413
  self.location.href,
414
414
  url,
415
415
  {
@@ -431,6 +431,13 @@ export default class Hls implements HlsEventEmitter {
431
431
  this.trigger(Events.MANIFEST_LOADING, { url: url });
432
432
  }
433
433
 
434
+ /**
435
+ * Gets the currently loaded URL
436
+ */
437
+ public get url(): string | null {
438
+ return this._url;
439
+ }
440
+
434
441
  /**
435
442
  * Start loading data from the stream source.
436
443
  * Depending on default config, client starts loading automatically when a source is set.
@@ -1069,56 +1069,6 @@ export default class MP4Remuxer implements Remuxer {
1069
1069
  this.isAudioContiguous = true;
1070
1070
  return audioData;
1071
1071
  }
1072
-
1073
- remuxEmptyAudio(
1074
- track: DemuxedAudioTrack,
1075
- timeOffset: number,
1076
- contiguous: boolean,
1077
- videoData: Fragment,
1078
- ): RemuxedTrack | undefined {
1079
- const inputTimeScale: number = track.inputTimeScale;
1080
- const mp4timeScale: number = track.samplerate
1081
- ? track.samplerate
1082
- : inputTimeScale;
1083
- const scaleFactor: number = inputTimeScale / mp4timeScale;
1084
- const nextAudioPts: number | null = this.nextAudioPts;
1085
- // sync with video's timestamp
1086
- const initDTS = this._initDTS as RationalTimestamp;
1087
- const init90kHz = (initDTS.baseTime * 90000) / initDTS.timescale;
1088
- const startDTS: number =
1089
- (nextAudioPts !== null
1090
- ? nextAudioPts
1091
- : (videoData.startDTS as number) * inputTimeScale) + init90kHz;
1092
- const endDTS: number =
1093
- (videoData.endDTS as number) * inputTimeScale + init90kHz;
1094
- // one sample's duration value
1095
- const frameDuration: number = scaleFactor * AAC_SAMPLES_PER_FRAME;
1096
- // samples count of this segment's duration
1097
- const nbSamples: number = Math.ceil((endDTS - startDTS) / frameDuration);
1098
- // silent frame
1099
- const silentFrame: Uint8Array | undefined = AAC.getSilentFrame(
1100
- track.parsedCodec || track.manifestCodec || track.codec,
1101
- track.channelCount,
1102
- );
1103
-
1104
- logger.warn('[mp4-remuxer]: remux empty Audio');
1105
- // Can't remux if we can't generate a silent frame...
1106
- if (!silentFrame) {
1107
- logger.trace(
1108
- '[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec',
1109
- );
1110
- return;
1111
- }
1112
-
1113
- const samples: Array<any> = [];
1114
- for (let i = 0; i < nbSamples; i++) {
1115
- const stamp = startDTS + i * frameDuration;
1116
- samples.push({ unit: silentFrame, pts: stamp, dts: stamp });
1117
- }
1118
- track.samples = samples;
1119
-
1120
- return this.remuxAudio(track, timeOffset, contiguous, false);
1121
- }
1122
1072
  }
1123
1073
 
1124
1074
  export function normalizePts(value: number, reference: number | null): number {
@@ -206,16 +206,20 @@ export function pickMostCompleteCodecName(
206
206
 
207
207
  export function convertAVC1ToAVCOTI(codec: string) {
208
208
  // Convert avc1 codec string from RFC-4281 to RFC-6381 for MediaSource.isTypeSupported
209
- const avcdata = codec.split('.');
210
- if (avcdata.length > 2) {
211
- let result = avcdata.shift() + '.';
212
- result += parseInt(avcdata.shift() as string).toString(16);
213
- result += ('000' + parseInt(avcdata.shift() as string).toString(16)).slice(
214
- -4,
215
- );
216
- return result;
209
+ // Examples: avc1.66.30 to avc1.42001e and avc1.77.30,avc1.66.30 to avc1.4d001e,avc1.42001e.
210
+ const codecs = codec.split(',');
211
+ for (let i = 0; i < codecs.length; i++) {
212
+ const avcdata = codecs[i].split('.');
213
+ if (avcdata.length > 2) {
214
+ let result = avcdata.shift() + '.';
215
+ result += parseInt(avcdata.shift() as string).toString(16);
216
+ result += (
217
+ '000' + parseInt(avcdata.shift() as string).toString(16)
218
+ ).slice(-4);
219
+ codecs[i] = result;
220
+ }
217
221
  }
218
- return codec;
222
+ return codecs.join(',');
219
223
  }
220
224
 
221
225
  export interface TypeSupported {