Skip to content

Commit

Permalink
fix: chapters event w/ preload none
Browse files Browse the repository at this point in the history
  • Loading branch information
luwes committed Oct 3, 2024
1 parent 9e96fd9 commit 173a0b8
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/js/media-store/state-mediator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,21 @@ export const stateMediator: StateMediator = {
'track[kind="chapters"][default][src]'
);

/* If `media` is a custom media element search in its shadow DOM. */
const shadowChaptersTrack = media.shadowRoot?.querySelector(
':is(video,audio) > track[kind="chapters"][default][src]'
);

/** @ts-ignore */
chaptersTrack?.addEventListener('load', handler);
/** @ts-ignore */
shadowChaptersTrack?.addEventListener('load', handler);

return () => {
/** @ts-ignore */
chaptersTrack?.removeEventListener('load', handler);
/** @ts-ignore */
shadowChaptersTrack?.removeEventListener('load', handler);
};
},
],
Expand Down

0 comments on commit 173a0b8

Please sign in to comment.