react-native-true-sight
Version:
A cross-platform video player with customizable controls for React Native.
16 lines (13 loc) • 556 B
text/typescript
import { useCallback, useState } from "react";
export function useVideoState(shouldAutoStart: boolean) {
const [videoLoading, setVideoLoading] = useState(true);
const [videoPaused, setVideoPaused] = useState(!shouldAutoStart);
return {
videoLoading,
videoPaused,
setVideoPlaying: useCallback(() => setVideoPaused(false), []),
setVideoPaused: useCallback(() => setVideoPaused(true), []),
setVideoLoading: useCallback(() => setVideoLoading(true), []),
setVideoNotLoading: useCallback(() => setVideoLoading(false), []),
};
}