Skip to content

Commit

Permalink
Fix additional asset player creation between assets at start
Browse files Browse the repository at this point in the history
Fix uncaught play() Promise
  • Loading branch information
robwalch committed Dec 17, 2024
1 parent 1dbc3ce commit a71332f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/controller/interstitials-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ export type PlayheadTimes = {
};

function playWithCatch(media: HTMLMediaElement | null) {
media?.play().catch(/* no-op */);
media?.play().catch(() => {
/* no-op */
});
}

export default class InterstitialsController
Expand Down Expand Up @@ -1383,7 +1385,7 @@ MediaSource ${JSON.stringify(attachMediaSourceData)} from ${logFromSource}`,
const { playingItem } = this;
if (
playingItem &&
playingItem !== this.bufferingItem &&
!this.itemsMatch(playingItem, this.bufferingItem) &&
!this.isInterstitial(playingItem)
) {
const timelinePos = this.timelinePos;
Expand Down Expand Up @@ -1644,7 +1646,7 @@ Schedule: ${scheduleItems.map((seg) => segmentToString(seg))}`,
} else if (
bufferIsEmpty &&
playingItem &&
bufferingItem !== playingItem &&
!this.itemsMatch(playingItem, bufferingItem) &&
bufferEndIndex === playingIndex
) {
this.bufferedToItem(playingItem);
Expand Down

0 comments on commit a71332f

Please sign in to comment.