Skip to content

fix: Android error handling, iOS memory leaks & Legacy View Manager Interop - #2

Draft
jhen0409 wants to merge 1 commit into
mainfrom
fix/android-error-handling-ios-interop-memory-leaks
Draft

fix: Android error handling, iOS memory leaks & Legacy View Manager Interop#2
jhen0409 wants to merge 1 commit into
mainfrom
fix/android-error-handling-ios-interop-memory-leaks

Conversation

@jhen0409

@jhen0409 jhen0409 commented Feb 2, 2026

Copy link
Copy Markdown
Member

Summary

This PR brings several stability and compatibility improvements from production patches.

Android Changes

Error Handling

  • Add try-catch for setDataSource and prepareAsync to prevent uncaught exceptions
  • Emit proper error events (MEDIA_ERROR_INVALID_SOURCE, MEDIA_ERROR_PREPARE_FAILED) instead of crashing
  • Move onLoad event to onPrepared for more consistent timing across platforms

Build

  • Fix monorepo path resolution in build.gradle (support 3 levels deep for nested workspaces)

iOS Changes

Memory Leak Fixes

  • Add _didRelease flag to prevent double-release crashes
  • Use weak references in time observer block to prevent retain cycles
  • Improve observer removal with try-catch to handle already-removed observers
  • Implement dealloc method for proper cleanup
  • Fix prepareForRecycle to properly clear player item

Legacy View Manager Interop

  • Add compatibility props and event callbacks for bridgeless architecture with interop layer
  • Support both Fabric event emitters and legacy callback blocks
  • Store current URI/headers for proper source reload capability

Testing

Tested in production with BRICKS app on both iOS and Android.

@jhen0409
jhen0409 marked this pull request as draft February 2, 2026 10:29
…nterop

## Android
- Add try-catch for setDataSource and prepareAsync to prevent crashes
- Emit proper error events (MEDIA_ERROR_INVALID_SOURCE, MEDIA_ERROR_PREPARE_FAILED)
- Move onLoad event to onPrepared for consistent timing
- Fix monorepo path resolution in build.gradle (3 levels deep)

## iOS
- Add Legacy View Manager Interop compatibility (props + event callbacks)
- Fix memory leaks with proper weak references in time observer block
- Add _didRelease flag to prevent double-release crashes
- Improve observer removal with try-catch
- Add reloadCurrentSource for proper recycling
- Implement dealloc for cleanup
- Store current URI/headers for source reload capability
- Fix prepareForRecycle to properly clear player item
@jhen0409
jhen0409 force-pushed the fix/android-error-handling-ios-interop-memory-leaks branch from d298fdb to 3f3e916 Compare February 2, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant