black screen after some videos in react native video

372 Views Asked by At

image

this is my 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"
  }

this is my setting.gradle

include ':react-native-video' project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')

this is my screen code

<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
                />
1

There are 1 best solutions below

0
Sel4 Media On

change source={{ uri: item.video, type: 'mp4' }} to source={{ uri: encodeURI(item.video), type: 'mp4' }}