Skip to content

Commit

Permalink
fix: update behaviour around native mse seeks
Browse files Browse the repository at this point in the history
  • Loading branch information
martinstark committed Mar 2, 2023
1 parent 1e5c245 commit adcd0f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/media-event-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ export const getMediaEventFilter = ({
const onPlay = (): void => {
if (isNotReady()) return;

// block mse plays triggered after buffering and seeks
if (!state.paused || !state.initialPlayFired) return;

// enable triggering deferred playing event when toggling play-pause
// during seeking or buffering
state = {
Expand Down Expand Up @@ -300,9 +303,8 @@ export const getMediaEventFilter = ({
};

if (state.paused) return;
// // potential logic to only propagate "real" pauses. Prevents pause events that are triggered
// // by an engine due to seeking (might be an issue in Safari).
// if (videoElement.readyState !== 4) return
// Propagate "real" pauses. Prevents pause events that are triggered by native MSE seek.
if (videoElement.readyState !== 4) return;

// Safari autoplay block triggers with a deferred loaded event,
// recover to a paused state
Expand Down

0 comments on commit adcd0f4

Please sign in to comment.