简体   繁体   中英

I can not play video with m3u8 format

I am building a project in React Native and I used the react-native-video dependency to play video streaming, but it does not play anything when the file is m3u8. Will it be the file codec?

Video playback is successful in other formats, but entering this url does not work.

This is my configuration in the Video component:

Version: 4.3.1

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

And this in 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}" 
}

And this 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'

Some work and others not for example I use this and it works for me

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM