Reputation: 371
I have a project where I must put some videos on my page. I didn't what they would be so I used this :
const video = React.useRef(null);
...
...
<Video
ref={video}
style={styles.video}
source={{
uri: "https://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4",
//https://www.youtube.com/watch?v=g57_0gejMig
}}
useNativeControls
isLooping
onPlaybackStatusUpdate={(status) => setStatus(() => status)}
/>
Howether it doesn't seems to work with url. Any idea?
Upvotes: 0
Views: 1321
Reputation: 17
You can try the below implementation.
It uses a video id from a link that just pastes the ID of the Youtube video in the below code.
import React from 'react';
import {View} from 'react-native';
import YoutubePlayer from 'react-native-youtube-iframe';
const App = () => {
return (
<View>
<YoutubePlayer
height={300}
play={true}
videoId={'84WIaK3bl_s'}
/>
</View>
);
};
Upvotes: 1