Video doesn't stop on most of iPhone/iOS versions when AR scene is unmounted causing memory leaks
Buthrakaur opened this issue · 0 comments
Buthrakaur commented
Environment
Please provide the following information about your environment:
- Development OS: Mac
- Device OS & Version: iOS 15, 16
- Version: ViroReact version 2.23.1 and React Native version 0.71.3
- Device(s): iPhone SE iOS 15.x, iPhone 8, iOS 16.5.1
Description
Video playback doesn't stop when AR scene is unmounted and the audio keeps playing after the scene is unmounted causing memory leak of AVPlayer instance. We tried to resolve this by pausing the playback when on AR scene unmount but it doesn't prevent memory leak of the AVPlayer instance. We tried this on multiple iPhones with mixed results:
- iPhone SE, iOS 15.x - video NOT stopping
- iPhone 12 pro - video stops correctly
- iPhone 8, iOS 16.5.1 - video stops when markerless triggering used but not stopping with a marker-based placement
Reproducible Demo
Just use a simple AR scene with ViroVideo
component opened from a screen in the app.
<ViroARScene onCameraTransformUpdate={onCameraTransformUpdate} onTrackingUpdated={onInitialized}>
<ViroVideo
position={offsetPosition}
loop={feature.loop}
rotation={objectRotation}
width={feature.size.width}
height={feature.size.height}
source={feature.source}
onBufferEnd={onLoadEnded}
onError={onLoadFailed}
/>
</ViroARScene>