5

I 'm searching the docs, but haven't succeeded yet to find a sample code. I need to play videos from my stream server. Is there any way? or may be react-js does not support videos on android yet.

Farshid Ashouri
  • 16,143
  • 7
  • 52
  • 66

2 Answers2

8

Yep. Took me a while to figure out, but the solution is easy.

Use react-native-video component which is cross-platform iOS and Android.

Implementation: Couldn't be simpler...

<Video source={{ uri: 'http://STREAM_URL/playlist.m3u8' }} />


Tips for playing live HLS .m3u8 streams on iOS and Android:

On iOS: Be sure to allow the stream's source domain as an exception domain on App Transport Security Settings on info.plist. While testing, I set "Allow Arbitrary Loads" to YES. Before I did this, the stream didn't come through at all.

On Android: Use the new exoplayer variant introduced in react-native-video 1.0. Here's how to enable that: #426 (comment)

dgurns
  • 104
  • 1
  • 3
0

React Native does not support it.

I have not used this, but you may find what you need in this plugin: https://github.com/ms88privat/react-native-video-gstreamer

John Shammas
  • 2,687
  • 1
  • 17
  • 33