react-nativereact-native-video

React Native Video selectedVideoTrack prop not working in android phones


selectedVideoTrack prop not working in android phone. Here is the Video componenet

        <Video
            source={{uri: uri}}
            ref={videoPlayer}
            poster={thumbnail}
            style={orientation === 'PORTRAIT' ? styles.video : styles.landscapeVideo}

            onLoadStart={onLoadStart}
            onLoad={onLoad}
            onProgress={onProgress}
            paused={paused}
            rate={playSpeed}

            selectedVideoTrack={{
                type: "resolution",
                value: 144
            }}

            repeat={true}
            controls={false}
            playInBackground={true}
            resizeMode={'stretch'}
            fullscreen={true}
            pictureInPicture={true}
            muted={false}
        />

m3u8 file

#EXTM3U
#EXT-X-STREAM-INF:BANDWIDTH=239800,RESOLUTION=256x144,CODECS="avc1.64000c,mp4a.40.2",FRAME-RATE=30.000
video_0_90.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=580800,RESOLUTION=854x480,CODECS="avc1.64001f,mp4a.40.2",FRAME-RATE=30.000
video_1_400.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=910800,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2",FRAME-RATE=30.000
video_2_700.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1240800,RESOLUTION=1920x1080,CODECS="avc1.640028,mp4a.40.2",FRAME-RATE=30.000
video_3_1000.m3u8
#EXT-X-ENDLIST

I am using "react-native-video": "^5.2.0"


Solution

  • added these lines in react-native.config.js help me to achieve it in android

    module.exports = {
        dependencies: {
            'react-native-video': {
                platforms: {
                    android: {
                        sourceDir: '../node_modules/react-native-video/android-exoplayer',
                    },
                },
            },
        },
        assets:['./src/assets/fonts/'],
    };
    

    remove assets:['./src/assets/fonts/'], if you don't have fonts directory.