shogo4405/HaishinKit.dart

Camera Not Closed

Closed this issue · 1 comments

Describe the bug

...When Leaving and Disposing the Page. (calling stream.close() has no effect on the camera referenced)

The bug is in this file

https://github.com/shogo4405/HaishinKit.dart/blob/main/android/src/main/kotlin/com/haishinkit/haishin_kit/RtmpStreamHandler.kt

Ctrf + F, camera,

you can see you called camera.open()

but never called close / dispose on the camera,

as a result the camera is never released even after leaving/closing the page (the privacy alert camera icon is still in the status bar)

To Reproduce

please check the source code in file

https://github.com/shogo4405/HaishinKit.dart/blob/main/android/src/main/kotlin/com/haishinkit/haishin_kit/RtmpStreamHandler.kt

Expected behavior

close camera when stream.close() is called

Version

latest

Smartphone info.

No response

Additional context

No response

Screenshots

No response

Relevant log output

No response

for anyone facing the same problem, you can pull the plugin source code and fix the problem yourself by changing the aforementioned kotlin file, starting at line 131, add camera.close(), and camera will be closed after you exit the streaming page.

        "$TAG#dispose" -> {
            eventSink?.endOfStream()
            **camera.close()**
            instance = null
            plugin.onDispose(hashCode())
            result.success(null)
        }