add hotkeys
This commit is contained in:
@@ -26,6 +26,8 @@ import {
|
||||
DefaultVideoLayout,
|
||||
defaultLayoutIcons,
|
||||
} from "@vidstack/react/player/layouts/default";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
import { Key } from "ts-key-enum";
|
||||
|
||||
const minPxPerSecBase = 150;
|
||||
|
||||
@@ -499,6 +501,15 @@ export const MediaPlayer = (props: {
|
||||
return fitZoomRatio;
|
||||
};
|
||||
|
||||
useHotkeys(
|
||||
" ",
|
||||
() => {
|
||||
if (!wavesurfer) return;
|
||||
onPlayClick();
|
||||
},
|
||||
[wavesurfer]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className="mb-2" ref={containerRef} />
|
||||
|
||||
@@ -5,6 +5,7 @@ import RecordPlugin from "wavesurfer.js/dist/plugins/record";
|
||||
import WaveSurfer from "wavesurfer.js";
|
||||
import { cn } from "@renderer/lib/utils";
|
||||
import { RadialProgress, useToast } from "@renderer/components/ui";
|
||||
import { useHotkeys } from "react-hotkeys-hook";
|
||||
|
||||
export const RecordButton = (props: {
|
||||
className?: string;
|
||||
@@ -17,6 +18,11 @@ export const RecordButton = (props: {
|
||||
const [duration, setDuration] = useState<number>(0);
|
||||
const { toast } = useToast();
|
||||
|
||||
useHotkeys(["command+alt+r", "control+alt+r"], () => {
|
||||
if (disabled) return;
|
||||
setIsRecording((isRecording) => !isRecording);
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
if (!isRecording) return;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@renderer/components/ui";
|
||||
import { ChevronDownIcon, Trash2Icon, InfoIcon, Share2Icon } from "lucide-react";
|
||||
|
||||
Reference in New Issue
Block a user