Add notifications
This commit is contained in:
31
Views/Video.js
Normal file
31
Views/Video.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import * as React from 'react';
|
||||
import { View, StyleSheet, Button } from 'react-native';
|
||||
import { Video, AVPlaybackStatus } from 'expo-av';
|
||||
|
||||
export default function App({videoUrl}) {
|
||||
const video = React.useRef(null);
|
||||
const [status, setStatus] = React.useState({});
|
||||
return (
|
||||
<View>
|
||||
<Video
|
||||
ref={video}
|
||||
style={styles.video}
|
||||
source={{
|
||||
uri: videoUrl,
|
||||
}}
|
||||
useNativeControls
|
||||
resizeMode="contain"
|
||||
isLooping
|
||||
onPlaybackStatusUpdate={status => setStatus(() => status)}
|
||||
/>
|
||||
<View style={styles.buttons}>
|
||||
<Button
|
||||
title={status.isPlaying ? 'Pause' : 'Play'}
|
||||
onPress={() =>
|
||||
status.isPlaying ? video.current.pauseAsync() : video.current.playAsync()
|
||||
}
|
||||
/>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user