ant-media / Ant-Media-Server

Ant Media Server is a live streaming engine software that provides adaptive, ultra low latency streaming by using WebRTC technology with ~0.5 seconds latency. Ant Media Server is auto-scalable and it can run on-premise or on-cloud.
https://antmedia.io
Other
4.25k stars 624 forks source link

Playlist broadcast not playing in react-native #3622

Open rehamkhawajahere opened 3 years ago

rehamkhawajahere commented 3 years ago

I am broadcasting mp4 using playlist feature on AMS and I want to play the stream in react-native application. I am using 'https://github.com/TecladistaProd/rn-antmedia' for playing but it's not working.

My URL looks like this for playing stream wss://localhost:5080/WebRTCAppEE/websocket''.

mekya commented 3 years ago

Hi @rehamkhawajahere ,

Thank you for the issue.

I've just some suspects on the URL wss://localhost:5080/WebRTCAppEE/websocket Please use public ip of your server. If it's a local instance, you may also need to use local IP to play the stream in another device.

Generally, it's hard for us to understand the problem in free-text format. Generally most of the time is just spent to understand the problem. So please use a simple bug template as follows

Steps to reproduce the issue 1. 2. 3.

Expected Behavior: ...

Actual Behavior: ...

rehamkhawajahere commented 3 years ago

@mekya Steps to reproduce the issue

  1. Create a playlist using the new live stream button. (I am using this URL in playlist 'http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4')
  2. Stream is working fine as I can watch it on 'https://my_public_server_ip:port/WebRTCAppEE/play.html?name=streamID'

Expected Behavior:

I want to play this stream on a mobile device using react native.

Actual Behavior:

Not playing on mobile. Though I have other streams also connected which I am sending using the mobile app and I can watch them on a viewer mobile as well.

P.S: I have also disabled h.264 in the admin panel of AMS as some Android devices only support V8 CODEC.

rehamkhawajahere commented 3 years ago

I believe your CODEC check buttons in settings of AMS are not respected in the case of the Playlist. Because I tested by playing stream now on IOS and it was working fine as expected but not in case of those android devices which do not support h.264.

mekya commented 3 years ago

Hi @rehamkhawajahere ,

I see. In order to make the VP8 encoding effective, you need to add at least one adaptive bitrate by also checking the VP8 box. (Otherwise, it will just relay the incoming h.264 to the viewers. ) Then you can play the stream with WebRTC.

If you want to play with HLS without VP8 enablement, you can add playOrder=hls as follows https://my_public_server_ip:port/WebRTCAppEE/play.html?name=streamID&playOrder=hls

Can you try and let us know if it works for you?

rehamkhawajahere commented 3 years ago

@mekya adding adaptive bitrate was not helpful at all to play the stream on android devices.

mekya commented 2 years ago

Hi @rehamkhawajahere ,

Yes you're right. On the other hand, the incoming video is H.264('http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4')) and some android devices can only play VP8. Then the only solution is transcoding the stream.

Alternatively, if you ingest WebRTC or convert the codec to VP8 for the ingested stream, you can play without adding adaptive bitrate.

Please let me know if you have any other idea or you think I'm missing something.

Regards, A. Oguz