feat: finish audiotrack switching

This commit is contained in:
Adrian Castro
2024-03-07 13:12:14 +01:00
parent fd1928c43d
commit 6deb39e8a7
8 changed files with 125 additions and 51 deletions

View File

@@ -5,6 +5,8 @@ import { usePlayerStore } from "~/stores/player/store";
export const PlayButton = () => {
const videoRef = usePlayerStore((state) => state.videoRef);
const status = usePlayerStore((state) => state.status);
const playAudio = usePlayerStore((state) => state.playAudio);
const pauseAudio = usePlayerStore((state) => state.pauseAudio);
return (
<FontAwesome
@@ -17,10 +19,12 @@ export const PlayButton = () => {
videoRef?.pauseAsync().catch(() => {
console.log("Error pausing video");
});
void pauseAudio();
} else {
videoRef?.playAsync().catch(() => {
console.log("Error playing video");
});
void playAudio();
}
}
}}