Skip to content

Commit

Permalink
Skip Interstitial events that do not reset MediaSource using `interst…
Browse files Browse the repository at this point in the history
…itialsManager.skip()`

(cherry picked from commit 928064edb0d802d1e6513bd509e65ef5c584f2e9)
  • Loading branch information
robwalch committed Jul 31, 2024
1 parent 5842cc2 commit 0021cfd
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/controller/interstitials-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,11 @@ export default class InterstitialsController
const targetItem = c.schedule.items?.[targetIndex];
// playingAsset player

if (playingItem && c.itemsMatch(playingItem, targetItem)) {
if (
playingItem &&
(c.itemsMatch(playingItem, targetItem) ||
playingItem.event?.appendInPlace)
) {
// seek in item
const assetPlayer = getAssetPlayer(c.playingAsset);
const media = assetPlayer?.media || c.hls.media;
Expand All @@ -354,8 +358,10 @@ export default class InterstitialsController
'currentTime',
);
const diff = time - currentTime;
media.currentTime += diff;
return;
if (media.currentTime + diff <= media.duration) {
media.currentTime += diff;
return;
}
}
}
// seek out of item or asset
Expand Down Expand Up @@ -481,10 +487,10 @@ export default class InterstitialsController
const event = item?.event;
if (event && !event.restrictions.skip) {
const index = c.schedule.findItemIndex(item);
if (!event.appendInPlace) {
c.advanceAfterAssetEnded(event, index, Infinity);
if (event.appendInPlace) {
seekTo(item.playout.end, 'playout');
} else {
// TODO: seek to start of next item
c.advanceAfterAssetEnded(event, index, Infinity);
}
}
},
Expand Down

0 comments on commit 0021cfd

Please sign in to comment.