问题描述
我在本机项目中使用EXPO
,该项目的目的是上传视频并最终将其显示在应用程序的不同屏幕中,对于celà,我使用了expo-av
,问题是该程序包仅在第一个屏幕上显示视频,例如,如果我导航到另一个屏幕,则该屏幕上的视频将不会显示。我长期找不到解决方案,请帮助我。谢谢您的理解。
例如代码
代码In Home Screen
import React from 'react';
import { StyleSheet,Text,View,Button } from 'react-native';
import { Video } from 'expo-av';
// import VideoPlayer from 'expo-video-player';
export const DetailsScreen = ({navigation}) => {
return(
<View style={styles.container}>
<Video
source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
rate={1.0}
volume={1.0}
isMuted={false}
resizeMode="cover"
shouldplay
isLooping
style={{ width: 300,height: 300 }}
/>
<Button
title='Back to home' onPress={() => {navigation.goBack()}}
/>
</View>
);
}
代码In Details Screen
,此屏幕的视频未显示,其他屏幕相同。
import React from 'react';
import { StyleSheet,Button } from 'react-native';
import { Video } from 'expo-av';
export const HomeScreen = ({navigation}) => {
return(
<View style={styles.container}>
<Video
source={{ uri: 'http://d23dyxeqlo5psv.cloudfront.net/big_buck_bunny.mp4' }}
rate={1.0}
volume={1.0}
isMuted={false}
resizeMode="cover"
shouldplay
isLooping
style={{ width: 300,height: 300 }}
/>
<Button
title='Go to DetailsScreen' onPress={() => {navigation.navigate('DetailsScreen')}}
/>
</View>
);
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)