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

Playback stop at the p2p communication when we use Android Sample App #4979

Open SangukChoi opened 1 year ago

SangukChoi commented 1 year ago

Hello Ant-Media-Team,

My name is Dante and I work for a company called Zigbang. We are currently testing p2p communication through the sample provided by Ant-Media-Team, and we have a few questions.

We are doing p2p communication, where peerA is using an Android device and connected to qwer streamId using the Android SDK Sample.

PeerB is using the HTML sample and connected to the same qwer streamId as peerA.

The communication between the two peers seems to be working, but the playback is frequently stopping on the peerB side.

You can see our situation below captured video file.

Could you please let us know what is the reason for this issue?

We changed PeerA's Android sample(MainActivity.java) like below and tested.

@@ -63,7 +63,7 @@ public class MainActivity extends Activity implements IWebRTCListener {
     /**
      * Mode can Publish, Play or P2P
      */
-    private String webRTCMode = IWebRTCClient.MODE_PUBLISH;
+    private String webRTCMode = IWebRTCClient.MODE_JOIN;

     private boolean enableDataChannel = true;

@@ -217,7 +217,7 @@ public class MainActivity extends Activity implements IWebRTCListener {

     public void startStreaming(View v) {
         //update stream id if it is changed
-        webRTCClient.setStreamId(streamIdEditText.getText().toString());
+        webRTCClient.setStreamId(/*streamIdEditText.getText().toString()*/"qwer");
         idlingResource.increment();
         if (!webRTCClient.isStreaming()) {
             ((Button) v).setText("Stop " + operationName);

In addition to the problem of playback stopping on peerB, it seems that onDisconnected is frequently called in the Android app and the connection is disconnected.

Although there are reconnection scenarios in the android sample app, is this part difficult to improve in the Android environment? I think the web sample (HTML) does not seem to have this problem.

Thank you. :) Dante.

Mohit-3196 commented 1 year ago

Hi @SangukChoi , How are you?

I made some tests this week with the latest Android SDK release and could see some fluctuation with stability between mobile and web. I will be continuing with some more tests and will update you in a couple of days.

I hope that is alright with you.

Thank you.

SangukChoi commented 1 year ago

Hello @Mohit-3196

We have changed our development direction from using Android SDK to below.

We are planning to use android's webview and showing HTML + Javascript at the webview. When we tested using webview and html+javascript sample, there were no issues.

In the future, development direction could be changed, and we can use Android SDK. If there are any points to review, could you please address them?

Thank you very much.

Mohit-3196 commented 1 year ago

Hi @SangukChoi , Thank you for the information.

Sure, I'll update you on any issues if there.

Thank you

Mohit-3196 commented 1 year ago

Hi @SangukChoi , I made some more tests with the updated Android SDK and it seems to be working without any issue for Peer to Peer on Peer B (Web) side as well and doesn't stop now. I have recorded a small video for the same here

So, if you would like to try it in your available time then please do it and let me know how it goes.

Thank you