React Native Video播放多个视频后出现黑屏问题求助
React Native 0.71.3 搭配 react-native-video@5.2.1 播放多视频后黑屏问题
在基于React Native 0.71.3的项目中使用react-native-video@5.2.1时,出现播放若干视频后屏幕黑屏的问题。以下是相关配置及代码:
相关配置
package.json 依赖
"dependencies": { "jetifier": "^2.0.0", "link": "^1.5.1", "link-preview-js": "^3.0.5", "moment": "^2.29.4", "react": "18.2.0", "react-native": "^0.71.3", "react-native-safe-area-context": "^4.5.0", "react-native-screens": "^3.19.0", "react-native-toast-message": "^2.1.6", "react-native-vector-icons": "^9.2.0", "react-native-video": "^5.2.1", "react-native-visibility-sensor": "^1.0.0", "react-native-webview": "^13.3.1", "react-redux": "^8.0.5", "redux": "^4.2.1", "redux-persist": "^6.0.0" }
settings.gradle 配置
include ':react-native-video' project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')
页面代码
<Video resizeMode='cover' paused={index === viewableIndex ? pause : true} style={styles.videoView} automaticallyWaitsToMinimizeStalling={false} source={{ uri: item.video, type: 'mp4' }} hideShutterView={true} bufferConfig={{ minBufferMs: 150, maxBufferMs: 3000, bufferForPlaybackMs: 100, bufferForPlaybackAfterRebufferMs: 100, }} useTextureView={true} progressUpdateInterval={250} onError={handleError} onLoadStart={handleLoadStart} onLoad={handleLoad} onReadyForDisplay={() => setVideoLoad(false)} repeat />
内容的提问来源于stack exchange,提问作者Wolf XpertLab
相关产品推荐
相关产品推荐

