Comments (6)
Hi @sebastienrouif,
I think you could call session.onPause() from onStop() method in Android. But please note, the onPause() and onStop() in Android are a little different.
OnPause: an activity has lost focus but is still visible. A paused activity is completely alive.
OnStop: an activity is completely obscured by another activity. It is no longer visible to the user so its window is hidden and it will often be killed by the system when memory is needed elsewhere.
Best,
Marina
from opentok-android-sdk-samples.
Thanks @marinaserranomontes ,
Yes, I'm well aware of the basic definition of onPause() and onStop(), I was wondering if there was any hidden reason you specifically recommended onPause().
The Picture in picture example can be simplified by calling session.onPause
in the activity onStop
lifecycle callback as there is no need to check isInPictureInPictureMode()
from opentok-android-sdk-samples.
hi @sebastienrouif ,
Please note, the sample shows a specific use case for PiP scenario, where we have a button in the sample to "enter in PiP mode", so, in the sample, we will be "onPause" from:
- PiP button
- Home button
In the sample, we want to continue showing the video if we are in PiP mode. In other, case, we want to stop the video rendering. That is the main reason why we have a check of the PiP mode in the onPause method.
Best,
Marina
from opentok-android-sdk-samples.
Hi @marinaserranomontes ,
when entering Pip the activity is Paused but not stopped moving :
if (session != null) { session.onResume(); }
to onStart
and
if (session != null) { session.onPause(); }
to onStop
would avoid specifically checking for isInPictureInPictureMode
I'm happy to raise a PR to show it
from opentok-android-sdk-samples.
Hi @sebastienrouif ,
I am not sure what is the specific case you want to test.
Regarding the sample we have in the repo and the doc for PiP, just to comment, the PiP mode is going to call to "onPause()" method, and in our sample, we don't want to stop the video rendering in the PiP case. That is the main reason, why we have a check for PiP mode in the "onPause()" callback.
But if we are not in PiP mode, and we pause the activity, we want to stop the video rendering for publishers and subscribers, and to do that, we are using the OpenTok SDK method: "session.onPause()".
https://developer.android.com/guide/topics/ui/picture-in-picture
You can observe "When your activity switches to PIP, the system places the activity in the paused state and calls the activity's onPause() method. Video playback should not be paused and should continue playing if the activity is paused while in PIP mode."
Best,
Marina
from opentok-android-sdk-samples.
Hi @sebastienrouif ,
Iām closing this issue because it has been inactive for a few weeks.
Please reopen if you still encounter this issue. You can also contribute directly to samples by providing a patch.
Thank you!
Best,
Marina
from opentok-android-sdk-samples.
Related Issues (20)
- Android client gets disconnected from the call after switch from Mobile data to WiFi HOT 9
- During voice call connection openTok need video permission HOT 2
- Black screen in video call when resume HOT 1
- Camera preview showing black screen when Resume HOT 2
- After enable video or voice during call stream not connect HOT 5
- Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 32370 (Thread-22), pid 31945 HOT 4
- Vulnerable WebRTC Version HOT 1
- java.lang.IndexOutOfBoundsException at contentView.draw(canvas) HOT 4
- Session 0: Exception while stopping repeating: android.hardware.camera2.CameraAccessException: CAMERA_DISCONNECTED (2): checkPidStatus:2462: The camera device has been disconnected HOT 1
- Black screen, camera not opened and video does not start with Camera2 example HOT 8
- Audio not coming in screen recorder Android HOT 3
- Call is in background but camera stopped with exception. HOT 4
- Bluetooth permission says its optional in documentation but crashes the app once removed HOT 1
- Why do we need the android.permission.READ_PHONE_STATE ? HOT 1
- Crashing on video call.Facing the same issue. HOT 13
- onDisconnected not called SubscriberListener HOT 1
- Crash issue EglCore HOT 5
- Crash issue Camera2VideoCapturer HOT 2
- Crash on 2.24.2 and 2.25.0 when enabling / disabling publisher video HOT 12
- Fatal Exception: java.lang.IllegalStateException: Session has been closed; further changes are illegal. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentok-android-sdk-samples.