Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stable Picture-In-Picture mode #67

Closed
msp-ampcome opened this issue Dec 30, 2021 · 19 comments
Closed

Stable Picture-In-Picture mode #67

msp-ampcome opened this issue Dec 30, 2021 · 19 comments

Comments

@msp-ampcome
Copy link

Hey, Hope you are doing well. We are trying to use the PIP mode. But once we enter the pip mode, we can interact with the app without any issues but video and audio become very unstable/glitchy. is there any way to stabilize this issue. Because in the jitsi meet app, the pip mode is working fine. Please let us know if there is any solution. Thank you for creating this plugin.

@jefaokpta
Copy link
Contributor

Have you tested the pip on Android or IOS? If it's on Android, did you need to change something in the native code?

@msp-ampcome
Copy link
Author

It is on android. I have to change the AndroidManifest in the plugin to enable PIP. but once enabled, going in and out of PIP is very jarring experience. but it working on jitsi meet app and flutter plugin.

@jefaokpta
Copy link
Contributor

It is on android. I have to change the AndroidManifest in the plugin to enable PIP. but once enabled, going in and out of PIP is very jarring experience. but it working on jitsi meet app and flutter plugin.

I had the same experience, on native code and in flutter works pretty well. Even with this issue I rather Ionic than others. It's more simple.

@calvinckho
Copy link
Owner

I intentionally disabled PIP on the plugin for this reason. I will investigate again and see if there is any solution.

@calvinckho
Copy link
Owner

@jefaokpta @msp-ampcome According to the Jitsi mobile SDK documentation:

Jitsi Meet SDK does not currently implement native Picture-in-Picture on iOS. If desired, apps need to implement non-native Picture-in-Picture themselves and resize JitsiMeetView.

I currently do not have time to work on this, but you are welcome to try and add non-native support for PIP in iOS and submit a PR.

As for PIP support on Android, I have done some work and seem to be able to get it to work. Try to install 2.1.2-beta.0 and deploy it on Android to test it.

@msp-ampcome
Copy link
Author

msp-ampcome commented Jan 4, 2022

@calvinckho Hey thanks for the quick update, I installed the beta version and tested it. Now PIP mode is working properly, Audio/Video is working as expected. But If i disconnect the call, the app is crashing, regardless of whether i entered PIP mode or not. This is the error I am getting and attached the screen record for your reference
`
E/JitsiMeetSDK: JitsiMeetUncaughtExceptionHandler FATAL ERROR
java.lang.RuntimeException: Unable to stop activity {com.kr4all.doctorapp/com.capacitor.jitsi.plugin.JitsiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jitsi.meet.sdk.JitsiMeetView.dispose()' on a null object reference
at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4956)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4927)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5001)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:233)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2116)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7904)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jitsi.meet.sdk.JitsiMeetView.dispose()' on a null object reference
at com.capacitor.jitsi.plugin.JitsiActivity.onStop(JitsiActivity.java:162)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1477)
at android.app.Activity.performStop(Activity.java:8358)
at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4948)
at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4927)
at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5001)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:233)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2116)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7904)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)

java.lang.RuntimeException: Unable to stop activity {com.kr4all.doctorapp/com.capacitor.jitsi.plugin.JitsiActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jitsi.meet.sdk.JitsiMeetView.dispose()' on a null object reference
    at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4956)
    at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4927)
    at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5001)
    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:233)
    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173)
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2116)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loop(Looper.java:236)
    at android.app.ActivityThread.main(ActivityThread.java:7904)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.jitsi.meet.sdk.JitsiMeetView.dispose()' on a null object reference
    at com.capacitor.jitsi.plugin.JitsiActivity.onStop(JitsiActivity.java:162)
    at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1477)
    at android.app.Activity.performStop(Activity.java:8358)
    at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:4948)
    at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:4927) 
    at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5001) 
    at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:233) 
    at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:201) 
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:173) 
    at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2116) 
    at android.os.Handler.dispatchMessage(Handler.java:106) 
    at android.os.Looper.loop(Looper.java:236) 
    at android.app.ActivityThread.main(ActivityThread.java:7904) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967) 

I/JitsiMeetSDK: [features/base/connection] No connection found while disconnecting.
[FeatureFlags] Source name signaling: false
D/JitsiMeetSDK: [modules/connectivity/NetworkInfo.js] updateNetworkInfo { isOnline: true }
I/JitsiMeetSDK: [features/analytics] Initialized 1 analytics handlers
I/JitsiMeetSDK: [features/base/media] Start muted:
D/JitsiMeetSDK: ExternalAPI Sending event: VIDEO_MUTED_CHANGED with data: { NativeMap: {"muted":0} }
I/JitsiMeetSDK: [features/base/media] Start audio only set to false`

https://drive.google.com/file/d/1rS0z_SlgpPvXN4NHHrNa_DVvn6Pm5OCQ/view?usp=sharing

@calvinckho
Copy link
Owner

can you try 2.1.2-beta.1? I fixed a bug which caused the crash.

@msp-ampcome
Copy link
Author

Will try and let you know

@msp-ampcome
Copy link
Author

@calvinckho Yeah, now the crash is fixed. Thank you so much. We really appreciate your quick response and your hard work. I tested it on Android 11. We will test it on more devices and let you know the results.

@msp-ampcome
Copy link
Author

@calvinckho sometimes the status bar is showing up on PIP mode. like this https://ibb.co/GCK0ss8

@calvinckho
Copy link
Owner

@msp-ampcome yes I also noticed it on my test app PIP window. The header bar would stay for a few seconds and then disappear. Have you noticed the same UI behavior in the official Jitsi app?

@msp-ampcome
Copy link
Author

msp-ampcome commented Jan 5, 2022

@calvinckho In the official app, the header bar is not showing. Maybe we have to remove the title bar ourselves like shown here.
https://stackoverflow.com/questions/36236181/how-to-remove-title-bar-from-the-android-activity/36236222

@calvinckho
Copy link
Owner

@msp-ampcome Thanks for your research. It was helpful. I disabled the header bar in the plugin's AndroidMannifest.xml file. Please try 2.1.2-beta.2 in your test app.

@msp-ampcome
Copy link
Author

@calvinckho Thanks for the update, We tested it, now the header bar is not coming. But we found an another bug. if the user closed the PIP window with the close button. the call is not disconnected on jitsi. if you rejoin the call. you can see 3 participants. You can see your name twice. one is current session, another one is the previous dead version. This issue is not coming, if we disconnect from the meeting properly via the reject call button on the expanded jitsi view.

@calvinckho
Copy link
Owner

Ok let me check on this issue.

@calvinckho
Copy link
Owner

@calvinckho Thanks for the update, We tested it, now the header bar is not coming. But we found an another bug. if the user closed the PIP window with the close button. the call is not disconnected on jitsi. if you rejoin the call. you can see 3 participants. You can see your name twice. one is current session, another one is the previous dead version. This issue is not coming, if we disconnect from the meeting properly via the reject call button on the expanded jitsi view.

OK. also want to check if this issue is still experienced when you use 2.1.2-beta.2 in Android?

@calvinckho
Copy link
Owner

@calvinckho Thanks for the update, We tested it, now the header bar is not coming. But we found an another bug. if the user closed the PIP window with the close button. the call is not disconnected on jitsi. if you rejoin the call. you can see 3 participants. You can see your name twice. one is current session, another one is the previous dead version. This issue is not coming, if we disconnect from the meeting properly via the reject call button on the expanded jitsi view.

OK. also want to check if this issue is still experienced when you use 2.1.2-beta.2 in Android?

I have tried to reproduce this bug. It tried to open and close the PIP window about 15 times. Out of the 15 times, only 1 time did it fail to leave the call. The other 14 times it was able to leave the call.

Perhaps it is a race condition? But as I was not able to reproduce the issue, it is very difficult to debug it. Also, I cannot merge it with the main branch until this issue is resolved.

@calvinckho
Copy link
Owner

calvinckho commented Feb 9, 2022

2.1.2 is released with the PiP mode disabled on Android because of the instability reported above. For future testing purposes, you can install 2.1.2+ and do the follow to enable PIP mode for Android:

  1. In Capacitor-Jitsi-Meet's AndroidManifest.xml, set android:supportsPictureInPicture="true"
  2. In JitsiActivity.java, uncomment the onStop() handler code (line 170 - 179).

Things to test and report:

  • Please let me know if you experience any issue with closing the PIP window manually.
  • The issue has been reported, but it was difficult to reproduce as it does not happen consistently. It can be due to race condition or other unknown causes.

Repository owner deleted a comment from msp-ampcome Feb 14, 2022
Repository owner deleted a comment from msp-ampcome Feb 14, 2022
@calvinckho
Copy link
Owner

calvinckho commented Mar 5, 2022

@calvinckho Thanks for the update, We tested it, now the header bar is not coming. But we found an another bug. if the user closed the PIP window with the close button. the call is not disconnected on jitsi. if you rejoin the call. you can see 3 participants. You can see your name twice. one is current session, another one is the previous dead version. This issue is not coming, if we disconnect from the meeting properly via the reject call button on the expanded jitsi view.

PIP in Android is now fully supported in the 2.2.0 release. The bug mentioned above should be fixed. To enable PIP in Android:

i. In the plugin's AndroidManifest.xml, set supportsPictureInPicture to true.

android:supportsPictureInPicture="true"

ii. Set the featureFlags param 'pip.enabled' to true

featureFlags: { 'pip.enabled': true }

For iOS PIP implementation, as the Jitsi SDK doesn't support native PIP yet, for those who need it in their iOS deployment, I offer consultation service to help you implement it in a non-native way. See this video for a demo:

RPReplay_Final1646465120.MP4

Feel free to DM me for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants