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 617 forks source link

React Native Conference Issue: in android phone, stream from ios is not showing #6466

Open Nardeep opened 2 months ago

Nardeep commented 2 months ago

Short description

In Android phone stream from iOS phone is not showing randomly , if its stuck once in android then it remains same every time join same room

Environment

Steps to reproduce

  1. Start the room from android
  2. Join from iOS
  3. Some time its worked in first time
  4. Leave room from iOS
  5. Join Again then iOS stream is not showing in android phone

Expected behavior

Audio and video in room should work properly from iOS to android and android to iOS.

Actual behavior

Some time it's showing blank or black screen . Sometime only video showing without audio.

Logs

In Ios when newTrackAvailable callback , then we got below in track and its working : {"stream": {"_reactTag": "AB6449B1-1E7B-4E88-9E67-B48F6DA76405", "_tracks": [[MediaStreamTrack]], "active": true, "id": "ARDAMS"}, "streamId": "6687da309976363d4aad6b99", "track": {"_constraints": {}, "_enabled": true, "_muted": false, "_peerConnectionId": 4, "_readyState": "live", "_settings": {}, "id": "ARDAMSv6606971a42e13a14fe22655b", "kind": "video", "label": "", "remote": true}, "trackId": "ARDAMSv6606971a42e13a14fe22655b"}

in android when newTrackAvailable callback , then we got below in track and its not showing video: {"stream": {"_reactTag": "5044ccf8-84b8-43d2-8fb0-5b0ff45437bc", "_tracks": [[MediaStreamTrack], [MediaStreamTrack], [MediaStreamTrack], [MediaStreamTrack]], "active": true, "id": "ARDAMS"}, "streamId": "6687dee59976363d4aad7586", "track": {"_constraints": {}, "_enabled": true, "_muted": true, "_peerConnectionId": 10, "_readyState": "live", "_settings": {}, "id": "ARDAMSa65ccc7e0b8f6425a57f7a30e", "kind": "audio", "label": "", "remote": true}, "trackId": undefined}

@yashtandon113 @mustafaboleken Please look into this and help us to resolve this

Nardeep commented 1 month ago

hi @burak-58 ,

We are facing this issue in multiple scenarios. For example, when we restart both Android and iOS devices, most of the time, both Android and iOS users join the conference room and are visible. However, when we cancel the first room and then create a second room without closing the app, this issue occurs randomly. Sometimes the Android user is not visible to other users, but the local view is visible, and sometimes the iOS user is not visible. When we check on the Ant Media console, both users are in the conference room.

Here is our handleDisconnect function: const handleDisconnect = useCallback(() => { if (adaptor) { if (adaptor?.localStream?.current) { adaptor?.localStream?.current ?.getTracks() ?.forEach((track) => track.stop());

}

adaptor.stop(user?._id);
console.log(
  adaptor?.localStream?.current?.id,
  "(adaptor.localStream?.current.id",
  user?._id
);

InCallManager.stop();

adaptor.stop(roomId);

removeRemoteVideo();
setIsPlaying(false);
setIsPublishing(false);

} }, [adaptor, roomId]);

mustafaboleken commented 1 month ago

Hi @Nardeep

It looks like after you stop tracks, it cannot be re initialize properly. I'm already working on a similar case right now. I will also let you know whenever it's ready to test.

Nardeep commented 1 month ago

@mustafaboleken We appreciate your efforts in addressing this issue. Could you please prioritize this matter and provide a solution as soon as possible? Our client is escalating the issue, and if it is not resolved promptly, we risk losing them. Your immediate attention to this matter would be greatly appreciated.

Sahilthakur2 commented 1 month ago

@mustafaboleken

I'm also encountering the same issue. When creating a second room without closing the app, users sometimes can't see each other in the conference room on both Android and iOS. The Ant Media console shows both users in the room, but the local view is visible while the remote view is not.

Looking forward to a resolution or any guidance on this.

mustafaboleken commented 1 month ago

Hi @Nardeep and @Sahilthakur2

I had a solution for the reuse problem and most likely it will be ready today for test. I will share it ASAP and I will ask for a quick review from you.

Sahilthakur2 commented 1 month ago

Hi @mustafaboleken ,

Thank you for the update. I'm glad to hear that a solution is in progress. I'll be ready to test it as soon as it's available. Please let me know if there are any specific aspects you would like me to focus on during the review.

Nardeep commented 1 month ago

hi @mustafaboleken , Could you please provide an update on its status?

mustafaboleken commented 1 month ago

Hi @Nardeep and @Sahilthakur2

Because I couldn't finalize it on Friday, I worked on it this morning and you can test it right now. There are a couple of new ways to update the track assignments and request the updated assignment list. Take a look at them, then we can discuss the implementation details.

https://github.com/ant-media/WebRTC-React-Native-SDK/pull/24

Sahilthakur2 commented 1 month ago

Hi @mustafaboleken

Thank you for the update. Could you please provide some guidance on how I can test this on my side? Any specific steps or requirements would be greatly appreciated.

Thanks,

Sahilthakur2 commented 1 month ago

Hi @mustafaboleken Do we need to patch these changes in our code or are you releasing the new version of the library?

mustafaboleken commented 1 month ago

Hi @Sahilthakur2

Let me tell you the steps:

If it works for you and there is no issue, our team will review the code and release a new version.

Sahilthakur2 commented 1 month ago

Hi @mustafaboleken

I am still encountering an issue. I have tested the implementation on four Android devices. It works fine on three of them, but on the fourth device, the stream is not visible to others, and the trackId is returning null.

Could you please provide some guidance on how to resolve this?

Sahilthakur2 commented 1 month ago

Hi @mustafaboleken

We are encountering issues with the new implementation. Sometimes, when we call adapter.publish, we do not receive the publish_started callback. As a result, remote users are not added to list.

This inconsistency is causing significant disruptions in the user experience. Could you please provide some guidance on how to troubleshoot and resolve this issue?

mustafaboleken commented 1 month ago

Hi @Sahilthakur2

Thanks for checking the implementation. Can you please share the logs with me? So, I can take a look what is wrong.

Sahilthakur2 commented 1 month ago

hi @mustafaboleken When we test on 2-3 devices, it works fine for the first two times. However, after that, on some devices, I can only see my local view while all other remote streams are blank. When I log the remove track, I get the following output:

{ "stream": { "_reactTag": "78cbc684-7e85-4725-9b88-5fbf34f6638e", "_tracks": [Array], "active": true, "id": "ARDAMS" }, "streamId": "66964c039c5d9e6efcd28d09", "track": { "_constraints": [Object], "_enabled": true, "_muted": false, "_peerConnectionId": 1, "_readyState": "live", "_settings": [Object], "id": "ARDAMSv65ccc7e0b8f6425a57f7a30e", "kind": "video", "label": "", "remote": true }, "trackId": undefined } As seen in the log, the trackId is undefined, which might be contributing to the issue.

Could you please provide guidance on why this might be happening and any potential solutions?

Thank you!

mustafaboleken commented 1 month ago

Hi @Sahilthakur2

Thanks for the review. I will take a look this issue.

mustafaboleken commented 1 month ago

Hi @Sahilthakur2

I couldn't reproduce it, unfortunately. Can you please tell me the device model and software version?

mekya commented 3 weeks ago

We don't get update from the user to confirm the things fully.

On the other hand, development has already resolved some tissue. @burak-58 please review and merge the PR.