mylisabox / flutter_mjpeg

Flutter widget to show mjpeg stream from URL
BSD 2-Clause "Simplified" License
30 stars 23 forks source link

iOS error handling seems inconsistant #35

Open eacarter opened 11 months ago

eacarter commented 11 months ago

First off, thank you to your team for developing this library, it's been a lot of help. I do notice some inconsistencies with the error handling for iOS compared to Android. In my application, I use the error attribute to display text when the connection/ video is interrupted and I've been having a hard time getting the same text to show up on iOS in a more consistent manner. At the moment, if my video is interrupted on iOS the video will freeze and stay frozen without an error response, using "print(error)" from the provided example for troubleshooting, and not displaying my error message 90% of the time this issue occurs. Is there maybe a workaround or possibly a fix that you all are working on that would help me out?

if it helps, I'm running Flutter 3.10.5

jaumard commented 11 months ago

Hello,

Thanks for the feedback, this is strange as there is no native code on this package, it's 100% Dart. Can you provide some way to reproduce this on my side so I can dig into that please?

eacarter commented 11 months ago

I can't provide the actual stream URL as it is coming from an ESP-32 camera that I have but below is the code that I'm using. inside the error block, I print the error, then try to return text centered in the view that states "no camera available". on Android, this works perfectly but on iOS I get it 10% of the time if the feed throws an exception. I don't know, it could very much be an issue with Flutter and iOS, I've been having a lot of those issues lately. Also, I'm using a physical iPhone 12 for testing.

EDIT: I apologize but I forgot to mention that in this particular view, I have an OrientationBuilder in my view that allows me to change aspects of the view based on whether the user is in portrait or landscape mode (just going from a stream view with a home button to a fullscreen view.) if I have issues with my stream then go from portrait to landscape of vice versa I assume the view is being rebuilt and the error that I'm looking for then registers with my iOS app.

Mjpeg( isLive: true, error: (context, error, stack) { print("error: $error"); return const Column( mainAxisAlignment: MainAxisAlignment.center, children: [ Text("No Camera Available", style: TextStyle(color: Colors.white)) ] ); }, stream: url, fit: BoxFit.contain );