Skip to content

Commit

Permalink
fixup! feat: mp4 mode handling
Browse files Browse the repository at this point in the history
  • Loading branch information
bwallberg committed Sep 27, 2024
1 parent 4c8a330 commit 89269cc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/demo/filtered-events.hook.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { useEffect, useState } from "react";
import { FilteredMediaEvent, getMediaEventFilter } from "../media-event-filter";

export const useFilteredEvents = ({ video, mp4Mode = false }: { video: HTMLVideoElement, mp4Mode: boolean }) => {
export const useFilteredEvents = ({
video,
mp4Mode = false,
}: {
video: HTMLVideoElement;
mp4Mode: boolean;
}) => {
const [playing, setPlaying] = useState(false);
const [seeking, setSeeking] = useState(false);
const [buffering, setBuffering] = useState(false);
Expand Down
4 changes: 2 additions & 2 deletions src/media-event-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type TMediaEventFilterOptions = {
callback: TFilteredMediaEventCallback;
// Should be set to `true` when playing MP4 files directly on the video element
// as the video element CAN stop buffering when readyState is 3 rather than 4.
mp4Mode: boolean
mp4Mode: boolean;
};

type TCallback = () => void;
Expand Down Expand Up @@ -141,7 +141,7 @@ export const getMediaEventFilter = ({
if (mp4Mode) {
onCanPlayThrough();
}
return
return;
}
// guard for when an engine sets playbackRate to 0 to continue buffering
// recover in "ratechange" event
Expand Down

0 comments on commit 89269cc

Please sign in to comment.