Conversation
hls.js flags many recoverable startup/stall/network conditions as fatal, expecting the host to call startLoad()/recoverMediaError() rather than tear the player down. Previously every fatal hlsError was surfaced as a terminal MEDIA_ERR_NETWORK, forcing consumers to fully re-init the controller to recover. Attempt hls.js's built-in recovery in place, bounded by a small attempt budget that resets once playback resumes, and only surface a terminal error when recovery is exhausted or the error is unrecoverable. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit df77369. Configure here.
| '($_hlsRecoveryAttempts/$_maxHlsRecoveryAttempts): ${errorData.details}', | ||
| ); | ||
| hls.recoverMediaError(); | ||
| return; |
There was a problem hiding this comment.
HLS recovery after dispose
Medium Severity
Fatal hlsError callbacks stay registered on _hls after dispose() (only stopLoad() runs and video subscriptions cancel). A late fatal error can still enter _handleFatalHlsError and call startLoad() or recoverMediaError(), restarting HLS work on a disposed player.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit df77369. Configure here.


Summary
hls.js flags many recoverable startup/stall/network conditions as
fatal, and its documented contract is for the host to attempt recovery in place (hls.startLoad()for network errors,hls.recoverMediaError()for media errors) rather than destroy the player. See hls.js error recovery.Previously the
hlsErrorhandler surfaced every fatal error straight to the plugin as a terminalMEDIA_ERR_NETWORKPlatformException. Consumers (MessengerX daily content, watch, and discovery players) each had to compensate by fully tearing down and re-creating theVideoPlayerControllerto recover — a heavy, duplicated workaround that also produced a brief error/black-frame flash.This PR makes the fork perform hls.js's built-in recovery in place:
startLoad()/recoverMediaError()bindings toHlsExtension(lib/hls.dart).hlsError,networkError->startLoad(),mediaError->recoverMediaError(), bounded by a small attempt budget (_maxHlsRecoveryAttempts = 3).onPlaying), so a later unrelated error gets a fresh set of attempts.PlatformExceptionas before (no behavior change for truly fatal cases).No public API changes beyond the two additive
Hlsbindings.Test plan
dart analyze libis clean (verified locally).Made with Cursor