opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
210 stars 170 forks source link

Android and iOS opentok lib not working for screenshare on android and iOS 2.26 version of lib #497

Closed gaffycool closed 2 months ago

gaffycool commented 6 months ago

Describe the bug In the android application, when the user goes into a call with the agent on the web, the video call is working on version 2.26.3, however, when the user on the web clicks on the screenshare button, nothing is happening on the android app. the screenshare is not coming through because the opentok lib is only sending he stream created event, but not sending the stream received event. but when the user clicks on the stop screenshare option on the web, then clicks on screenshare again for the second time, then the andorid app gets the stream created and stream received event coming through, which then shows the screen of the web to the mobile app. this is an issue with the opentok lib, the previous version of the application was working fine and the agent was able to click on the screenshare option on the web and it shows the screenshare first time. This issue is also happening on iOS.

To Reproduce Steps to reproduce the behavior:

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Device (please compete the following information):

Additional context Add any other context about the problem here.

janoonaj commented 5 months ago

Hello, I've tried with the playground using version 2.27 and it seems to work.

On the v27.0 changelog says This version fixes an issue where certain events were being dropped

Could be your problem solved in the last version?

v-kpheng commented 5 months ago

@gaffycool, are you able to reproduce with the latest release 2.27.0? Also, are you currently working with Support on this issue?

GaffyVhi commented 4 months ago

hi @janoonaj @v-kpheng this issue is still happening on 2.27.0 and it is not fixed. I have also verified with the open tok sample app. And it has not been fixed, If possible are you available on teams or webex, our organisation needs to get this fixed for our customer facing medical app and so it is urgent that this is fixed but I can run through the android app and show you the events, but can confirm it is not fixed on the 2.27.0 version, it is still not showing the correct events. please can we arrange a meeting so I can screenshare and show you, if you let me know your email and a time you are available i will send the invite so we can try resolve this today thank you for your replies

v-kpheng commented 4 months ago

@GaffyVhi, I'm sorry, but we can't directly arrange a sync with engineering. Please escalate to your account manager for that.

That said:

GaffyVhi commented 4 months ago

@GaffyVhi, I'm sorry, but we can't directly arrange a sync with engineering. Please escalate to your account manager for that.

That said:

  • Can you please confirm which version this use case worked with previously? The description mentions 2.26.3, but we never released that version for Android or iOS, afacit.
  • Can you please try to reproduce using one of our sample apps? That'll provide us with what we need to help root cause.
  • Lastly, to confirm, you're not able to reproduce using the latest 2.27.1 release, yes?

Hi @v-kpheng thanks for your reply,

v-kpheng commented 4 months ago

@GaffyVhi, the team tried to reproduce the issue but couldn't. Which sample app did you use? If you create a PR with your changes, we can take a look.

goncalocostamendes commented 3 months ago

@gaffycool if the issue was not solved yet, I can assist you

GaffyVhi commented 3 months ago

@gaffycool if the issue was not solved yet, I can assist you

hi @goncalocostamendes yes please it would be better if we could hop on a call and I can go through the issue, we are just observing the response from the opentok service in our viewmodel

when the user goes into the call with the agent and the agent clicks on screenshare on the web, in the android logcat i can see that the sdk is returning the stream created event, and does not give us the stream received event. When the agent then clicks on the screenshare again to turn it off, and then clicks it again to turn it on, i can see in the android logcat that we then get stream created and stream received, and then the screenshare works. So the issue is that we are not receiving stream created + stream received events together on the first time we do screenshare on the web to the app. If we can get the sdk to provide us the stream received event (im not sure what this is doing exactly but must be something to do with opening a socket or connection) then the screenshare will work first time.

now if i compare this to the previous version of the opentok lib we used 2.25.3 on android, the screenshare was working because when the agent on the web clicked on screenshare the first time he did it we got both events stream created and stream received

@v-kpheng i managed to reproduce it on your latest sample opentok android app (the only change i made on the app was replace the sdk keys with our keys from our project and it is reproducible again in this app)

GaffyVhi commented 3 months ago

@GaffyVhi, the team tried to reproduce the issue but couldn't. Which sample app did you use? If you create a PR with your changes, we can take a look. @v-kpheng https://github.com/opentok/opentok-android-sdk-samples and the only change i made was to replace the sdk keys, then did the call from the portal to the app, and the findings mentioned here: https://github.com/opentok/opentok-android-sdk-samples/issues/497#issuecomment-2034162918

GaffyVhi commented 3 months ago

@goncalocostamendes I have emailed through to your team via my company email, if you are able to check and arrange a meeting via hangouts/webex that would be great and I can screenshare and show you the exact issue and its reproducible steps, the company is pushing to get this resolved asap as it has been an issue that has been here a while so would be good if we can try to setup a meeting today/this week

goncalocostamendes commented 2 months ago

@GaffyVhi you are completely right, using the majority of our sample apps, following your use case, the mobile device will not display the screensharing publisher.

The reason for such issue is that the vast majority of our samples are made to only support one subscriber, since they only serve as a way to demonstrate our video conferencing functionality. As such, the issue is not strictly directed to a screensharing publisher, but to any newer publisher, camera or screen.

The please the following code https://github.com/opentok/opentok-android-sdk-samples/blob/main/Basic-Video-Chat-Java/app/src/main/java/com/tokbox/sample/basicvideochat/MainActivity.java#L91C1-L102C10. If you notice the app will only subscribe to the stream received if the subscriber object is null. By not running session.subscribe(subscriber);, onStreamCreated will never be triggered as you noticed.

If your user requirements require more than one subscriber, please use the following sample app as a base for your project.

https://github.com/opentok/opentok-android-sdk-samples/tree/main/Multiparty-Constraint-Layout-Java

goncalocostamendes commented 2 months ago

@GaffyVhi @gaffycool since the root cause of the issue was analysed and a solution is provided, I will close this ticket. Please open it if you still encounter any issues