riccardo-lomazzi / camera_macos

Flutter stub plugin for camera implementation for macOS
MIT License
11 stars 9 forks source link

stopImageStream doesn't work #14

Closed scognito closed 1 month ago

scognito commented 2 months ago

When I call await stopImageStream and then isStreamingImageData, I get always true. After digging a bit I found that the function stopImageStream does not set events to null.

I modified the code to this:

  @override
  Future<void> stopImageStream() async {
    await events?.cancel();
    events = null; // added this
  }

It works, but sometimes the app crashes on CameraMacosPlugin.swift with this error:

_cameramacos/CameraMacosPlugin.swift:117: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value+

I don't have time to fix this though

Knightro63 commented 1 month ago

Hi @scognito,

Thanks for reporting this issue. I will take a look and see if I can update it to address this issue.

scognito commented 1 month ago

You can add the line I added. I didn't make a PR just because there is still the crash on CameraMacosPlugin.swift. It should be trivial to fix though

riccardo-lomazzi commented 1 month ago

I've added the stream cancelling function and changed the function signature to support error handling. It should be released in the next update. Thank you!