NativeScript/mlkit

IOS & Android Bug: Wrong behavior of pause and torchOn parameters

cjohn001 opened this issue · 0 comments

The pause and torchOn parameters are not working as expected and behave different on Android and IOS.

Current Behavior iOS:

if pause = true && torchOn = true
-> video stream stopped when MlKitView is loaded and torch is activated. As expected. However, when video stream gets started (torchOn still true) the torch gets deactivated

Current behavior on Android:

if pause = true && torchOn = true
-> video stream is started when MlKitView is loaded and torch is off. Initial values of parameters do not have an effect.

I think the expected behavior should be discussed first. I see two options how the behavior of the parameters could be:

  1. If torchOn=true, torch is activated as soon as video stream is started, and stopped when video stream is stopped (hence, independently from each other) Please check behavior when app is sent to background (suspended) and comes back to foreground. This currently also leads to an inconsistency on iOS and Android.

  2. torch is only activated when video stream is started and deactivated when stopped. Hence torchOn and pause depend on each other. Also in this case status would need to be invalidated when app is suspended (send to background and reactivated again, as this deactivates the torch and does not reactivate it currently)

My use case would work with variant 1 and 2. With variant 1 out of the box. I would like to activate the video stream and then directly like to enable the torch. Therefore I actually expected the torch only to be activated with the camera is active.
However, it could be a valuable feature for others if the torch could be activated independently from the camera, hence variant 2 might be also feasible but would have to cover more conditions, i.e. when camera gets activated reset torch to selected torchOn state, and also when app is resumed from background