TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.17k stars 2.89k forks source link

[BUG]: AVPlayer Notifications Crash App When Switching Tracks After Background #4188

Open AlexEKoren opened 3 weeks ago

AlexEKoren commented 3 weeks ago

Version

6.4.5

What platforms are you having the problem on?

iOS

System Version

iOS 17

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

After playing a file, locking the screen, unlocking, then changing the track, the following crash occurs:

The app crashes with: *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot remove an observer <NSKeyValueObservance 0x30005b600> for the key path "currentItem.videoComposition" from <AVPlayer 0x300dcac00>, most likely because the value for the key "currentItem" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the AVPlayer class.'

It's unclear why this is only happening after a screen lock. Possibly some other observers are added for background playback that aren't cleaned up correctly?

Reproduction Link

repository link

Reproduction

Steps to reproduce:

  1. Configure player for offline playback
  2. Start playback of a file (we are using DRM protected files, but I don't believe it's relevant for this issue)
  3. Let the file play and load
  4. Lock the screen then unlock
  5. Change the track by setting a new source
github-actions[bot] commented 3 weeks ago

Thank you for your issue report. Please note that the following information is missing or incomplete:

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority

There is a newer version of the library available. You are using version 6.4.5, while the latest stable version is 6.6.1. Please update to the latest version and check if the issue still exists.

Note: If the issue still exists, please update the issue report with the latest information.

freeboub commented 2 weeks ago

Can you reproduce with the last version 6.6.1 ? There was a lot of rework linked to DRM on this version "Change the track by setting a new source" -> it is not clear to me do you change track or source ?