-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Severe UI Freezing When errorBuilder is Triggered Repeatedly
Description
The errorBuilder callback in ChewieController causes severe UI freezing when network connectivity issues trigger continuous error callbacks.
During poor network conditions, the underlying video player (FFmpeg) generates repeated ffurl_read returned 0xffffff92 TCP errors. These errors invoke errorBuilder in a tight, infinite loop on the main thread, overwhelming the UI and freezing the application.
Root Cause
- Network connectivity becomes unstable during video playback
- FFmpeg/video player emits continuous
ffurl_read returned 0xffffff92errors - Each error synchronously triggers
errorBuilder - The callback executes on the UI thread (logging, analytics, widget building, etc.)
- With no rate limiting/debouncing, hundreds/thousands of error callbacks flood the UI thread
- Application becomes completely frozen
Error Pattern
Error: ffurl_read returned 0xffffff92
Error: ffurl_read returned 0xffffff92
Error: ffurl_read returned 0xffffff92
... (repeats continuously during network issues)
Reproduction Steps
- Create a
ChewieControllerwith anerrorBuilderperforming any operation (logging, analytics, widget building, etc.) - Start video playback with a network URL
- Simulate unstable/poor network conditions
- Observe continuous
ffurl_read returned 0xffffff92errors in logs - UI freezes as the error callback is executed infinitely
Problematic Code Example
ChewieController(
videoPlayerController: newController,
errorBuilder: (context, errorMessage) {
debugPrint('Error: $errorMessage'); // Called hundreds of times per second
analytics.track(
AnalyticsPayload(
key: AnalyticsKeys.errorFromVideoPlayer,
props: {...?widget.analyticsPayload, 'errorMessage': errorMessage},
),
); // Heavy operation repeated infinitely
return const SizedBox.shrink(); // Widget rebuild repeated infinitely
},
);Expected Behavior
errorBuildershould not be called infinitely for the same error- The callback should be debounced/throttled or only triggered once per error event
- Application UI should remain responsive even under poor network conditions
Proposed Solutions
- Add internal debouncing to
errorBuildercalls - Allow developers to configure max frequency or rate limiting of error callbacks
- Provide an option to emit only the latest error rather than triggering for every repeated FFmpeg error
Environment
- Chewie version: 1.11.3
- Video Player version: 2.9.5
- Flutter version: stable 3.27.4
- Platform: Android
Metadata
Metadata
Assignees
Labels
No labels