在react-native-video中选择了VideoTrack道具不起作用

时间:2020-10-12 02:23:23

标签: react-native react-native-video hls.js

我正在使用react-native-video来显示hls视频。

视频链接:-https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8

由于视频以hls格式显示,因此我需要手动或自动更改视频质量,但是我无法使用react-native-video来实现这一点。我也使用reactjs在网络上做到了这一点,并取得了相当成功。我还通过添加react-native.config.js文件并粘贴这些代码来设置了react-native-video的exoplayer。


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



但是我的问题是,大多数道具在此播放器中不起作用。由于selectedVideoTrack无法正常工作。

VideoComponet代码:

      <Video
          ref={videoRef}
          source={{
            uri: 'https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8',
          }}
          resizeMode={'contain'}
          style={styles.fullscreenVideo}
          fullscreen={true}
          hls={true}
          rate={1.0}
          volume={1}
          muted={false}
          repeat={false}
          playInBackground={false}
          playWhenInactive={false}
          minLoadRetryCount={5}
          selectedVideoTrack={{
            type: 'resolution',
            value: 240,
          }}
          onError={(err) => {
            console.error(err);
          }}
          onSeek={(data) => {
            console.log(`seeked data `, data);
          }}
          onBuffer={(data) => {
            console.log('buffer data is ', data);
          }}
          reportBandwidth={true}
          onBandwidthUpdate={(data) => console.log('bandwidth updated', data)}
          selectedVideoTrack={{
            type: 'resolution',
            value: 360,
          }}

        />


如果有人可以建议我其他一些方法来实现这一目标,请

0 个答案:

没有答案