Camera in use indicator doesn't go away
After calling stopStreaming() the onDisconnect event successfully fires and the streaming is stopped, although my phone is still showing a green color that indicates camera is still in use and only goes away if I entirely close the application, what is the problem?
Versions: "@api.video/react-native-livestream": "^1.0.0", "react-native": "0.66.4",
Testing device: iPhone XS ios 15.4.1
Hi,
Yes, indeed the preview is still running on background. This is definitely a bug and it only happens in iOS: we don't stop camera preview when going to background. We already fix that issue in develop. Unfortunatly there is still a crash on Android and to fix this one, we will have to update react native framework. This is something we haven't succeeded yet.
Regards, Thibault
Hi,
We released v1.1.0 that should fix the issue. Could you give v1.1.0 a try?
Best regards, Thibault
Hi,
We released v1.1.0 that should fix the issue. Could you give v1.1.0 a try?
Best regards, Thibault
Hello, I updated to 1.1.0 but unfortunately the indicator still doesn't go away. Tested on iPhone XS ios 15.4.1
Hello,
The green color means that camera is still running. As long as the camera is running (even only previewing).
It disappears only if you send your application to background (just tested it).
Maybe your pods have not been updated. Could you verified in your Podfile.lock if iOS ApiVideoLiveStream version is 0.2.1?
Hello, The green color means that camera is still running. As long as the camera is running (even only previewing). It disappears only if you send your application to background (just tested it). Maybe your pods have not been updated. Could you verified in your
Podfile.lockif iOS ApiVideoLiveStream version is 0.2.1?
Hi, indeed sending the app in the background it removes the green color, but isn't it possible to remove that without having to close the app? isn't that supposed to happen on stopStreaming() call?
No it is not possible. iOS displays the green light as soon as the camera is running. It is not something we can change. You have the same behavior with the native camera application. See https://support.apple.com/en-gb/HT211876 There is nothing we can do about it: closing the issue.
No it is not possible. iOS displays the green light as soon as the camera is running. It is not something we can change. You have the same behavior with the native camera application. See https://support.apple.com/en-gb/HT211876 There is nothing we can do about it: closing the issue.
But going to another screen where the component is not mounted anymore the camera shouldn't be running?
You are right. I haven't thougth of that case. It is something I need to investigate. In the worst case scenario, we will add stopPreview method.
Any update on this issue? Camera is running in the background even if you are on another screen and its drain the battery.
If anyone wants to take up this issue. I have two non-working projects where this issue was resolved. v1 I cant remember why i had to abandon this one. v2 The preview would stop after the first frame had been rendered.
I remember having this issue, but dont remember how it was fixed. And couldnt find what i had done different back then to fix it.
@BlueBazze That would be really great if you remember how you did fix this issue :)
Does anyone know how to detect that an UIView is being put to background from a RN iOS part? I can't find anything :(
It seems that overriding removeFromSuperview in ReactNativeLiveStreamView could do the job like this:
override public func removeFromSuperview() {
super.removeFromSuperview()
liveStream.stopPreview()
}
We will have to add a stopPreview and a startPreview API in https://github.com/apivideo/api.video-ios-live-stream
@ThibaultBee any progress in this issue?
Would really appreciate if there is any solution for this issue. We have used the library in production and would have to revert to an older version of our app because of the green light and the iOS crashes. Presently the following happens with the app
- LiveStream gets mounted and the green and yellow light come up
- If I start the stream, then stop the stream and navigate out, then 2 out of 10 times the light goes off.
- Rest of the time it stays in.
- If I navigate back to the LiveStream component, it sometimes crashes and sometimes it doesn't.
I will investigate further and share crash logs from XCode. Thank you
Hi,
I already added stopPreview and startPreview in iOS live stream.
Still missing the removeFromSuperview and tests.
I have tried to make a fix. I am not 100 % that will fix this issue. Can anyone test https://github.com/apivideo/api.video-reactnative-live-stream/tree/bugfix/background_preview?
This should be fixed in v1.2.1