feat: cleaned up video player, added functionality, zooming in/out, timeline position viewer, keyboard controls
This commit is contained in:
18
apps/web/src/hooks/use-playback-controls.ts
Normal file
18
apps/web/src/hooks/use-playback-controls.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { useEffect } from "react";
|
||||
import { usePlaybackStore } from "@/stores/playback-store";
|
||||
|
||||
export function usePlaybackControls() {
|
||||
const { toggle } = usePlaybackStore();
|
||||
|
||||
useEffect(() => {
|
||||
const handleKeyDown = (e: KeyboardEvent) => {
|
||||
if (e.code === "Space" && e.target === document.body) {
|
||||
e.preventDefault();
|
||||
toggle();
|
||||
}
|
||||
};
|
||||
|
||||
document.addEventListener("keydown", handleKeyDown);
|
||||
return () => document.removeEventListener("keydown", handleKeyDown);
|
||||
}, [toggle]);
|
||||
}
|
Reference in New Issue
Block a user