add play and seek buttons

This commit is contained in:
Jorrin
2024-02-12 18:47:20 +01:00
parent 9dbe9e663f
commit 5bc848ed5f
6 changed files with 105 additions and 12 deletions

View File

@@ -0,0 +1,29 @@
import { FontAwesome } from "@expo/vector-icons";
import { usePlayerStore } from "~/stores/player/store";
export const PlayButton = () => {
const videoRef = usePlayerStore((state) => state.videoRef);
const status = usePlayerStore((state) => state.status);
return (
<FontAwesome
name={status?.isLoaded && status.isPlaying ? "pause" : "play"}
size={36}
color="white"
onPress={() => {
if (status?.isLoaded) {
if (status.isPlaying) {
videoRef?.pauseAsync().catch(() => {
console.log("Error pausing video");
});
} else {
videoRef?.playAsync().catch(() => {
console.log("Error playing video");
});
}
}
}}
/>
);
};