2

我正在 React Native 中构建一个项目,我使用 react-native-video 依赖项来播放视频流,但是当文件为 m3u8 时它不会播放任何内容。会是文件编解码器吗?

其他格式的视频播放成功,但是输入这个url不起作用。

这是我在 Video 组件中的配置:

版本:4.3.1

<Video source={{uri: 
"https://s3.amazonaws.com/yojma/hls/movie/yvZmxnCwaHGSLUpKFzoTlYrOXRdWQgePIqihbfcs/main.m3u8", 
type:"m3u8"} }/>

这在 app/build.gradle 中:

dependencies { compile project(':react-native-video-exoplayer') 
implementation "com.facebook.react:react-native:+" // From node_modules 
implementation fileTree(dir: "libs", include: ["*.jar"]) implementation 
"com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 
}

而这个settings.gradle:

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

1 回答 1

-5

有些工作,有些不工作,例如我用这个,它对我有用

         <Video
            source={{ uri: 'http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8' }}
            rate={1.0}
            volume={1.0}
            isMuted={false}
            resizeMode="cover"
            shouldPlay={false}
            useNativeControls={true}
            isLooping
            style={{ width: 300, height: 300 }}
          />
        </View>
于 2019-11-27T09:35:29.533 回答