On some devices, removing a track from the playlist can cause a crash. Plugin crashes with uncaught exception NSInternalInconsistencyException.
After some investigation, it was found that this only seems to happen on old versions of iOS (10.x is affected; 11 and above seems to be ok).
However, there is clearly one place in the code where tracks are being removed from the playlist, without the corresponding observers being removed. So maybe it's possible this issue is being masked somehow in the newer OSes? I'm no expert, but it seems fairly clear to me at what point the observers should be removed (from looking at other parts of the code, like when a new playlist is created and an old one is deallocated).
Reproduce Scenario (including but not limited to)
iOS 10.x with Ionic, streaming tracks
Steps to Reproduce
On a device running iOS 10.x, create a playlist, then try to remove tracks from the playlist
Platform and Version
iOS 10.3
Cordova CLI version and cordova platform version
Cordova CLI version 7.1.0
Plugin version
0.6.0
Logs taken while reproducing problem
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'An instance 0x170298ba0 of class AudioTrack was deallocated while key value observers were still registered with it. Current observation info: <NSKeyValueObservationInfo 0x17043ac80> (
<NSKeyValueObservance 0x170259ad0: Observer: 0x1700d5cb0, Key path: status, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c16, Property: 0x170257790>
<NSKeyValueObservance 0x170257940: Observer: 0x1700d5cb0, Key path: duration, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c17, Property: 0x170257820>
<NSKeyValueObservance 0x170259aa0: Observer: 0x1700d5cb0, Key path: loadedTimeRanges, Options: <New: YES, Old: YES, Prior: NO> Context: 0x1001f4c18, Property: 0x170257970>
Expected Behaviour
A track can be removed from playlist safely
Actual Behaviour
On some devices, removing a track from the playlist can cause a crash. Plugin crashes with uncaught exception
NSInternalInconsistencyException
.After some investigation, it was found that this only seems to happen on old versions of iOS (10.x is affected; 11 and above seems to be ok).
However, there is clearly one place in the code where tracks are being removed from the playlist, without the corresponding observers being removed. So maybe it's possible this issue is being masked somehow in the newer OSes? I'm no expert, but it seems fairly clear to me at what point the observers should be removed (from looking at other parts of the code, like when a new playlist is created and an old one is deallocated).
Reproduce Scenario (including but not limited to)
iOS 10.x with Ionic, streaming tracks
Steps to Reproduce
On a device running iOS 10.x, create a playlist, then try to remove tracks from the playlist
Platform and Version
iOS 10.3
Cordova CLI version and cordova platform version
Cordova CLI version 7.1.0
Plugin version
0.6.0
Logs taken while reproducing problem