/
Muip
/
ProBody
Обзор
Документация
Войти
/
Muip
/
ProBody
Код
Запросы
0
Задачи
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
components/VideoSplash.tsx
47 строк
1 KB
chmerev
new
14 авг 2024, 12:02
14 авг 2024, 12:02
595f266
Код
Авторство
О чём код?
import React from 'react'; import { View, StyleSheet, Dimensions } from 'react-native'; import { Video, AVPlaybackStatus, ResizeMode } from 'expo-av'; const VideoSplash: React.FC = () => { const videoRef = React.useRef<Video>(null); const videoStatus = React.useRef<AVPlaybackStatus | null>(null); const handlePlaybackStatusUpdate = (status: AVPlaybackStatus) => { videoStatus.current = status; }; React.useEffect(() => { videoRef?.current?.playAsync(); // if (videoStatus.current?.isLoaded && videoStatus.current.isPlaying) { // } }, []); return ( <View style={styles.container}> <Video ref={videoRef} source={require('assets/video/splash.mp4')} //'assets/video/splash.mp4' style={styles.video} resizeMode={ResizeMode.STRETCH} isLooping onPlaybackStatusUpdate={handlePlaybackStatusUpdate} /> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'black', justifyContent: 'center', alignItems: 'center', }, video: { width: Dimensions.get('window').width, height: Dimensions.get('window').height, }, }); export default VideoSplash;