2022-10-07 16:41:43 +02:00
|
|
|
import React from 'react';
|
|
|
|
|
import { View, Dimensions } from 'react-native';
|
|
|
|
|
// FileSytem
|
|
|
|
|
import * as FileSystem from 'expo-file-system';
|
|
|
|
|
// Video
|
2022-12-29 15:25:30 +01:00
|
|
|
import { ResizeMode } from 'expo-av';
|
2022-10-07 16:41:43 +02:00
|
|
|
import VideoPlayer from 'expo-video-player';
|
|
|
|
|
|
|
|
|
|
class VideoScreen extends React.Component {
|
|
|
|
|
render() {
|
|
|
|
|
const { uuid } = this.props.route.params;
|
2022-12-29 15:25:30 +01:00
|
|
|
let width = Dimensions.get("window").width;
|
|
|
|
|
let height = Dimensions.get("window").height;
|
|
|
|
|
|
|
|
|
|
// if portrait
|
|
|
|
|
if (height > width) {
|
|
|
|
|
let tmpHeight = height;
|
|
|
|
|
height = width - 150;
|
|
|
|
|
width = tmpHeight + 100;
|
|
|
|
|
} else {
|
|
|
|
|
height = height - 100;
|
|
|
|
|
}
|
2022-10-07 16:41:43 +02:00
|
|
|
return (
|
2022-12-29 15:25:30 +01:00
|
|
|
<View style={{ flex: 1, backgroundColor: 'black' }}>
|
2022-10-07 16:41:43 +02:00
|
|
|
<VideoPlayer
|
2022-12-29 15:25:30 +01:00
|
|
|
defaultControlsVisible={true}
|
|
|
|
|
fullscreen={{
|
|
|
|
|
visible: false
|
|
|
|
|
}}
|
|
|
|
|
slider={{
|
|
|
|
|
minimumTrackTintColor: '#ea4f52',
|
|
|
|
|
thumbTintColor: '#ea4f52',
|
|
|
|
|
}}
|
|
|
|
|
style={{
|
|
|
|
|
height: height,
|
|
|
|
|
width: width
|
|
|
|
|
}}
|
2022-10-07 16:41:43 +02:00
|
|
|
videoProps={{
|
|
|
|
|
shouldPlay: true,
|
2022-12-29 15:25:30 +01:00
|
|
|
resizeMode: ResizeMode.CONTAIN,
|
2022-10-07 16:41:43 +02:00
|
|
|
source: {
|
|
|
|
|
uri: FileSystem.documentDirectory + uuid + '.mp4',
|
|
|
|
|
},
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default VideoScreen;
|