hls.js 1.6.3-0.canary.11213 → 1.6.3-0.canary.11216

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
@@ -1165,7 +1165,7 @@
1165
1165
  // Some browsers don't allow to use bind on console object anyway
1166
1166
  // fallback to default if needed
1167
1167
  try {
1168
- newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3-0.canary.11213");
1168
+ newLogger.log("Debug logs enabled for \"" + context + "\" in hls.js version " + "1.6.3-0.canary.11216");
1169
1169
  } catch (e) {
1170
1170
  /* log fn threw an exception. All logger methods are no-ops. */
1171
1171
  return createLogger();
@@ -2248,8 +2248,6 @@
2248
2248
  if (!track) {
2249
2249
  continue;
2250
2250
  }
2251
- var sampleCount = void 0;
2252
- var firstKeyFrame = void 0;
2253
2251
  var trackTimes = tracks[id] || (tracks[id] = {
2254
2252
  start: NaN,
2255
2253
  duration: 0,
@@ -2297,12 +2295,10 @@
2297
2295
  var sampleDuration = defaultSampleDuration;
2298
2296
  for (var j = 0; j < truns.length; j++) {
2299
2297
  var trun = truns[j];
2300
- sampleCount = readUint32(trun, 4);
2298
+ var sampleCount = readUint32(trun, 4);
2299
+ var sampleIndex = trackTimes.sampleCount;
2301
2300
  trackTimes.sampleCount += sampleCount;
2302
2301
  if (track.type === ElementaryStreamTypes.VIDEO) {
2303
- if (firstKeyFrame === undefined) {
2304
- firstKeyFrame = -1;
2305
- }
2306
2302
  var dataOffsetPresent = trun[3] & 0x01;
2307
2303
  var firstSampleFlagsPresent = trun[3] & 0x04;
2308
2304
  var sampleDurationPresent = trun[2] & 0x01;
@@ -2316,8 +2312,8 @@
2316
2312
  }
2317
2313
  if (firstSampleFlagsPresent && sampleCount) {
2318
2314
  var isNonSyncSample = trun[offset + 1] & 0x01;
2319
- if (!isNonSyncSample) {
2320
- firstKeyFrame = 0;
2315
+ if (!isNonSyncSample && trackTimes.keyFrameIndex === undefined) {
2316
+ trackTimes.keyFrameIndex = sampleIndex;
2321
2317
  }
2322
2318
  offset += 4;
2323
2319
  if (sampleDurationPresent) {
@@ -2349,8 +2345,8 @@
2349
2345
  if (sampleFlagsPresent) {
2350
2346
  var _isNonSyncSample = trun[offset + 1] & 0x01;
2351
2347
  if (!_isNonSyncSample) {
2352
- if (firstKeyFrame === -1) {
2353
- firstKeyFrame = sampleCount - (remaining + 1);
2348
+ if (trackTimes.keyFrameIndex === undefined) {
2349
+ trackTimes.keyFrameIndex = trackTimes.sampleCount - (remaining + 1);
2354
2350
  trackTimes.keyFrameStart = sampleDTS;
2355
2351
  }
2356
2352
  }
@@ -2362,7 +2358,6 @@
2362
2358
  sampleDTS += sampleDuration;
2363
2359
  rawDuration += sampleDuration;
2364
2360
  }
2365
- trackTimes.keyFrameIndex = firstKeyFrame;
2366
2361
  } else {
2367
2362
  rawDuration += defaultSampleDuration * sampleCount;
2368
2363
  }
@@ -11070,80 +11065,6 @@
11070
11065
  };
11071
11066
  }
11072
11067
 
11073
- /**
11074
- * Encodes binary data to base64
11075
- *
11076
- * @param binary - The binary data to encode
11077
- * @returns The base64 encoded string
11078
- *
11079
- * @group Utils
11080
- *
11081
- * @beta
11082
- */
11083
- function base64encode(binary) {
11084
- return btoa(String.fromCharCode.apply(String, binary));
11085
- }
11086
-
11087
- /**
11088
- * This implements the rounding procedure described in step 2 of the "Serializing a Decimal" specification.
11089
- * This rounding style is known as "even rounding", "banker's rounding", or "commercial rounding".
11090
- *
11091
- * @param value - The value to round
11092
- * @param precision - The number of decimal places to round to
11093
- * @returns The rounded value
11094
- *
11095
- * @group Utils
11096
- *
11097
- * @beta
11098
- */
11099
- function roundToEven(value, precision) {
11100
- if (value < 0) {
11101
- return -roundToEven(-value, precision);
11102
- }
11103
- var decimalShift = Math.pow(10, precision);
11104
- var isEquidistant = Math.abs(value * decimalShift % 1 - 0.5) < Number.EPSILON;
11105
- if (isEquidistant) {
11106
- // If the tail of the decimal place is 'equidistant' we round to the nearest even value
11107
- var flooredValue = Math.floor(value * decimalShift);
11108
- return (flooredValue % 2 === 0 ? flooredValue : flooredValue + 1) / decimalShift;
11109
- } else {
11110
- // Otherwise, proceed as normal
11111
- return Math.round(value * decimalShift) / decimalShift;
11112
- }
11113
- }
11114
-
11115
- /**
11116
- * Constructs a relative path from a URL.
11117
- *
11118
- * @param url - The destination URL
11119
- * @param base - The base URL
11120
- * @returns The relative path
11121
- *
11122
- * @group Utils
11123
- *
11124
- * @beta
11125
- */
11126
- function urlToRelativePath(url, base) {
11127
- var to = new URL(url);
11128
- var from = new URL(base);
11129
- if (to.origin !== from.origin) {
11130
- return url;
11131
- }
11132
- var toPath = to.pathname.split('/').slice(1);
11133
- var fromPath = from.pathname.split('/').slice(1, -1);
11134
- // remove common parents
11135
- while (toPath[0] === fromPath[0]) {
11136
- toPath.shift();
11137
- fromPath.shift();
11138
- }
11139
- // add back paths
11140
- while (fromPath.length) {
11141
- fromPath.shift();
11142
- toPath.unshift('..');
11143
- }
11144
- return toPath.join('/');
11145
- }
11146
-
11147
11068
  function toArrayBuffer(view) {
11148
11069
  if (view instanceof ArrayBuffer) {
11149
11070
  return view;
@@ -16756,7 +16677,7 @@
16756
16677
  return !remuxResult.audio && !remuxResult.video && !remuxResult.text && !remuxResult.id3 && !remuxResult.initSegment;
16757
16678
  }
16758
16679
 
16759
- var version = "1.6.3-0.canary.11213";
16680
+ var version = "1.6.3-0.canary.11216";
16760
16681
 
16761
16682
  // ensure the worker ends up in the bundle
16762
16683
  // If the worker should not be included this gets aliased to empty.js
@@ -20728,6 +20649,20 @@
20728
20649
  return value ? '?1' : '?0';
20729
20650
  }
20730
20651
 
20652
+ /**
20653
+ * Encodes binary data to base64
20654
+ *
20655
+ * @param binary - The binary data to encode
20656
+ * @returns The base64 encoded string
20657
+ *
20658
+ * @group Utils
20659
+ *
20660
+ * @beta
20661
+ */
20662
+ function base64encode(binary) {
20663
+ return btoa(String.fromCharCode.apply(String, binary));
20664
+ }
20665
+
20731
20666
  var BYTES = 'Byte Sequence';
20732
20667
 
20733
20668
  // 4.1.8. Serializing a Byte Sequence
@@ -20804,6 +20739,34 @@
20804
20739
  return "@" + serializeInteger(value.getTime() / 1000);
20805
20740
  }
20806
20741
 
20742
+ /**
20743
+ * This implements the rounding procedure described in step 2 of the "Serializing a Decimal" specification.
20744
+ * This rounding style is known as "even rounding", "banker's rounding", or "commercial rounding".
20745
+ *
20746
+ * @param value - The value to round
20747
+ * @param precision - The number of decimal places to round to
20748
+ * @returns The rounded value
20749
+ *
20750
+ * @group Utils
20751
+ *
20752
+ * @beta
20753
+ */
20754
+ function roundToEven(value, precision) {
20755
+ if (value < 0) {
20756
+ return -roundToEven(-value, precision);
20757
+ }
20758
+ var decimalShift = Math.pow(10, precision);
20759
+ var isEquidistant = Math.abs(value * decimalShift % 1 - 0.5) < Number.EPSILON;
20760
+ if (isEquidistant) {
20761
+ // If the tail of the decimal place is 'equidistant' we round to the nearest even value
20762
+ var flooredValue = Math.floor(value * decimalShift);
20763
+ return (flooredValue % 2 === 0 ? flooredValue : flooredValue + 1) / decimalShift;
20764
+ } else {
20765
+ // Otherwise, proceed as normal
20766
+ return Math.round(value * decimalShift) / decimalShift;
20767
+ }
20768
+ }
20769
+
20807
20770
  var DECIMAL = 'Decimal';
20808
20771
 
20809
20772
  // 4.1.5. Serializing a Decimal
@@ -21195,6 +21158,38 @@
21195
21158
  return value != null && value !== '' && value !== false;
21196
21159
  }
21197
21160
 
21161
+ /**
21162
+ * Constructs a relative path from a URL.
21163
+ *
21164
+ * @param url - The destination URL
21165
+ * @param base - The base URL
21166
+ * @returns The relative path
21167
+ *
21168
+ * @group Utils
21169
+ *
21170
+ * @beta
21171
+ */
21172
+ function urlToRelativePath(url, base) {
21173
+ var to = new URL(url);
21174
+ var from = new URL(base);
21175
+ if (to.origin !== from.origin) {
21176
+ return url;
21177
+ }
21178
+ var toPath = to.pathname.split('/').slice(1);
21179
+ var fromPath = from.pathname.split('/').slice(1, -1);
21180
+ // remove common parents
21181
+ while (toPath[0] === fromPath[0]) {
21182
+ toPath.shift();
21183
+ fromPath.shift();
21184
+ }
21185
+ // add back paths
21186
+ while (fromPath.length) {
21187
+ fromPath.shift();
21188
+ toPath.unshift('..');
21189
+ }
21190
+ return toPath.join('/');
21191
+ }
21192
+
21198
21193
  var toRounded = function toRounded(value) {
21199
21194
  return Math.round(value);
21200
21195
  };