diff --git a/example/src/App.tsx b/example/src/App.tsx index cbb9a2c7..3be6941c 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,38 +1,41 @@ import * as React from 'react'; import { Button, Dimensions, Platform, StyleSheet, View } from 'react-native'; -import { VideoView, createPlayer } from 'react-native-video'; - -const player = createPlayer('https://www.w3schools.com/html/mov_bbb.mp4'); +import { VideoView, createSource, useVideoPlayer } from 'react-native-video'; export default function App() { - const [show, setShow] = React.useState(true); + const [show, setShow] = React.useState(false); - // You can easily access player! - const play = React.useCallback(() => { - player.play(); - }, []); - - const pause = React.useCallback(() => { - player.pause(); - }, []); - - const seek = React.useCallback(() => { - player.currentTime = 3; - }, []); + const player = useVideoPlayer('https://www.w3schools.com/html/mov_bbb.mp4'); return ( - + {/* */} {/* Two VideoViews with same player are supported not supported on Android */} - {Platform.OS === 'ios' && show && ( + {show && ( )} -