hls.js 1.6.0-beta.2.0.canary.10833 → 1.6.0-beta.2.0.canary.10835

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.
@@ -75,7 +75,9 @@ export type PlayheadTimes = {
75
75
  };
76
76
 
77
77
  function playWithCatch(media: HTMLMediaElement | null) {
78
- media?.play().catch(/* no-op */);
78
+ media?.play().catch(() => {
79
+ /* no-op */
80
+ });
79
81
  }
80
82
 
81
83
  export default class InterstitialsController
@@ -1383,7 +1385,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`,
1383
1385
  const { playingItem } = this;
1384
1386
  if (
1385
1387
  playingItem &&
1386
- playingItem !== this.bufferingItem &&
1388
+ !this.itemsMatch(playingItem, this.bufferingItem) &&
1387
1389
  !this.isInterstitial(playingItem)
1388
1390
  ) {
1389
1391
  const timelinePos = this.timelinePos;
@@ -1474,16 +1476,23 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))}`,
1474
1476
  });
1475
1477
 
1476
1478
  // Update schedule item references
1477
- // Do not change Interstitial playingItem - used for INTERSTITIAL_ASSET_ENDED and INTERSTITIAL_ENDED
1478
- if (playingItem && !playingItem.event) {
1479
- this.playingItem = this.updateItem(playingItem, this.timelinePos);
1479
+ // Do not replace Interstitial playingItem without a match - used for INTERSTITIAL_ASSET_ENDED and INTERSTITIAL_ENDED
1480
+ if (playingItem) {
1481
+ const updatedPlayingItem = this.updateItem(playingItem, this.timelinePos);
1482
+ if (this.itemsMatch(playingItem, updatedPlayingItem)) {
1483
+ this.playingItem = updatedPlayingItem;
1484
+ }
1480
1485
  }
1481
- // Do not change Interstitial bufferingItem - used for transfering media element or source
1486
+ // Do not replace Interstitial bufferingItem without a match - used for transfering media element or source
1482
1487
  const bufferingItem = this.bufferingItem;
1483
1488
  if (bufferingItem) {
1484
- if (!bufferingItem.event) {
1485
- this.bufferingItem = this.updateItem(bufferingItem, this.bufferedPos);
1486
- } else if (!this.updateItem(bufferingItem)) {
1489
+ const updatedBufferingItem = this.updateItem(
1490
+ bufferingItem,
1491
+ this.bufferedPos,
1492
+ );
1493
+ if (this.itemsMatch(bufferingItem, updatedBufferingItem)) {
1494
+ this.bufferingItem = updatedBufferingItem;
1495
+ } else if (bufferingItem.event) {
1487
1496
  // Interstitial removed from schedule (Live -> VOD or other scenario where Start Date is outside the range of VOD Playlist)
1488
1497
  this.bufferingItem = null;
1489
1498
  this.clearInterstitial(bufferingItem.event, null);
@@ -1644,7 +1653,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))}`,
1644
1653
  } else if (
1645
1654
  bufferIsEmpty &&
1646
1655
  playingItem &&
1647
- bufferingItem !== playingItem &&
1656
+ !this.itemsMatch(playingItem, bufferingItem) &&
1648
1657
  bufferEndIndex === playingIndex
1649
1658
  ) {
1650
1659
  this.bufferedToItem(playingItem);
@@ -1656,14 +1665,12 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))}`,
1656
1665
  ): InterstitialScheduleItem | null {
1657
1666
  const bufferingLast = this.bufferingItem;
1658
1667
  const schedule = this.schedule;
1659
- const { items, events } = schedule;
1660
1668
 
1661
- if (
1662
- items &&
1663
- events &&
1664
- (!bufferingLast ||
1665
- schedule.findItemIndex(bufferingLast) !== schedule.findItemIndex(item))
1666
- ) {
1669
+ if (!this.itemsMatch(item, bufferingLast)) {
1670
+ const { items, events } = schedule;
1671
+ if (!items || !events) {
1672
+ return bufferingLast;
1673
+ }
1667
1674
  const isInterstitial = this.isInterstitial(item);
1668
1675
  const bufferingPlayer = this.getBufferingPlayer();
1669
1676
  const timeRemaining = bufferingPlayer
@@ -1692,6 +1699,8 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))}`,
1692
1699
  bufferingIndex: this.findItemIndex(item),
1693
1700
  playingIndex: this.findItemIndex(this.playingItem),
1694
1701
  });
1702
+ } else if (this.bufferingItem !== item) {
1703
+ this.bufferingItem = item;
1695
1704
  }
1696
1705
  return bufferingLast;
1697
1706
  }