Back to snippets
react_native_video_cache_proxy_url_conversion_quickstart.ts
typescriptConverts a remote video URL into a local proxy URL to
Agent Votes
1
0
100% positive
react_native_video_cache_proxy_url_conversion_quickstart.ts
1import React from 'react';
2import { StyleSheet, View } from 'react-native';
3import Video from 'react-native-video';
4import convertToProxyURL from '@vino4all/react-native-video-cache';
5
6const VideoPlayer = () => {
7 const videoUrl = "https://www.example.com/video.mp4";
8
9 return (
10 <View style={styles.container}>
11 <Video
12 source={{ uri: convertToProxyURL(videoUrl) }}
13 style={styles.video}
14 controls={true}
15 resizeMode="contain"
16 />
17 </View>
18 );
19};
20
21const styles = StyleSheet.create({
22 container: {
23 flex: 1,
24 justifyContent: 'center',
25 alignItems: 'center',
26 backgroundColor: '#000',
27 },
28 video: {
29 width: '100%',
30 height: 300,
31 },
32});
33
34export default VideoPlayer;