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.22k stars 618 forks source link

WebRTC to RTMP not working #3372

Closed rehamkhawajahere closed 1 year ago

rehamkhawajahere commented 3 years ago

I have predefined streamID on AMS and I am using a react-native application to broadcast on predefined streamID. In RTMP endpoint of predefined streamID I have added FB streamID credentials to publish webRTC to social media(RTMP endpoint)

When I start broadcasting WebRTC I can see my stream on AMS but it's not publishing on RTMP endpoint.

To check I tried to broadcast RTMP from OBS to predefined streamID, in that scenario it worked as expected and publish the broadcast to social media.

So is it possible to broadcast WebRTC and then publish it to RTMP endpoint? If yes then kindly give brief support on this.

rehamkhawajahere commented 3 years ago

Details of react-native client application:

I am using "react-native-webrtc" and "rn-antmedia" for publishing stream to AMS and my URL looks like this "ws://remote_server_url:5080/WebRTCAppEE/websocket"

yashtandon113 commented 3 years ago

Hi @rehamkhawajahere As discussed yesterday over support side and as checked the stream is working fine to RTMP end point when we are publishing the stream through Ant Media WebRTC JavaScript SDK. The issue is coming when the stream is published through react-native application.

So is it possible to share your sample react-native application with us so that we can check the issue at our end.

Also please make sure that both audio and video should be available when you are publishing stream through your react-native application. It might be the issue that due to no audio in stream, it is not publishing to facebook. Have you also tried by publishing the stream to Youtube or any other platform?

Please let us know.

rehamkhawajahere commented 3 years ago

As you mentioned I was sending both audio and video for publishing and I used YouTube as well for publishing but unfortunately no success.

You can download the sample code from here “https://drive.google.com/file/d/1X9GWpfhPrxr4aH_UtYa2VWINuU1QC0pk/view?usp=sharing”. Kindly change the URL in Publisher.tsx file.

yashtandon113 commented 3 years ago

Hi @rehamkhawajahere Thanks for sharing details. We will check and get back to you asap.

Madhukaran commented 2 years ago

Hi, I'm also facing the same issue. If I published my stream to AMS from React and I cross checked with the AMS Api call for getting the particular stream Details. For my case

REST ENDPOINT:- https://localhost:5080/WebRTCAppEE/rest/v2/broadcasts/JPseZyFTmhxehuIT Response:-

{
    "streamId": "JPseZyFTmhxehuIT",
    "status": "broadcasting",
    "playListStatus": null,
    "type": "liveStream",
    "publishType": null,
    "name": null,
    "description": null,
    "publish": true,
    "date": 1634816095237,
    "plannedStartDate": 0,
    "plannedEndDate": 0,
    "duration": 0,
    "endPointList": null,
    "playListItemList": null,
    "publicStream": true,
    "is360": false,
    "listenerHookURL": null,
    "category": null,
    "ipAddr": null,
    "username": null,
    "password": null,
    "quality": null,
    "speed": 0.0,
    "streamUrl": null,
    "originAdress": "127.0.1.1",
    "mp4Enabled": 0,
    "webMEnabled": 0,
    "expireDurationMS": 0,
    "rtmpURL": "rtmp://127.0.1.1/WebRTCAppEE/JPseZyFTmhxehuIT",
    "zombi": true,
    "pendingPacketSize": 0,
    "hlsViewerCount": 0,
    "webRTCViewerCount": 0,
    "rtmpViewerCount": 0,
    "startTime": 1634816096009,
    "receivedBytes": 0,
    "bitrate": 0,
    "userAgent": "N/A",
    "latitude": null,
    "longitude": null,
    "altitude": null,
    "mainTrackStreamId": null,
    "subTrackStreamIds": [],
    "absoluteStartTimeMs": 0,
    "webRTCViewerLimit": -1,
    "hlsViewerLimit": -1,
    "subFolder": null,
    "currentPlayIndex": 0
}

so on the response i'm getting status as broadcasting and rtmp Url if i suppose to play rtmp url with ffplay i coudn't acess the stream. so, is there any way for this. correct me if i'm anyway understood this process wrong.

yashtandon113 commented 2 years ago

Hi @Madhukaran You can play the stream with ffplay like ffplay -i "rtmp://127.0.1.1/WebRTCAppEE/JPseZyFTmhxehuIT live=1"