Skip to content

Commit

Permalink
fix video ios player
Browse files Browse the repository at this point in the history
  • Loading branch information
topAmity committed Jan 6, 2024
1 parent d308720 commit f53a1e9
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/components/react-native-image-viewing/dist/ImageViewing.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,26 @@ function ImageViewing({
[imageList]
);
const playVideoFullScreen = async () => {
if(Platform.OS === 'ios'){
if (Platform.OS === 'ios') {
onClickPlayButton(currentImageIndex);
setIsPlaying(true)
setPlayingUri(`https://api.${apiRegion}.amity.co/api/v3/files/${videoPosts[currentImageIndex]?.videoFileId?.original}/download`)
}else{
setTimeout(() => {
videoPlayerRef.current.presentFullscreenPlayer();
}, 100);

} else {
navigation.navigate('VideoPlayer', { source: `https://api.${apiRegion}.amity.co/api/v3/files/${videoPosts[currentImageIndex]?.videoFileId?.original}/download` })
}

};

useEffect(() => {
if (videoPlayerRef && playingUri && isPlaying) {
videoPlayerRef.current.presentFullscreenPlayer();
}
}, [playingUri, isPlaying])
// useEffect(() => {
// if (videoPlayerRef && playingUri.length > 0 && isPlaying) {
// videoPlayerRef.current.presentFullscreenPlayer();
// }
// }, [playingUri, isPlaying])

if (!visible) {
return null;
}
Expand Down Expand Up @@ -192,14 +196,14 @@ function ImageViewing({
)}
</View>


<Video
source={{ uri: playingUri }}
onVideoFullscreenPlayerWillDismiss={onClosePlayer}
ref={videoPlayerRef}
fullscreen={true}

/>
<Video
source={{ uri: playingUri }}
onVideoFullscreenPlayerWillDismiss={onClosePlayer}
ref={videoPlayerRef}
fullscreen={true}

/>


</Modal>
Expand Down

0 comments on commit f53a1e9

Please sign in to comment.