Skip to content

Commit

Permalink
removing already removed observer that is not associated with the pla…
Browse files Browse the repository at this point in the history
…yer causes crash due to due to uncaught NSInvalidArgumentException
  • Loading branch information
gsgou committed Mar 2, 2023
1 parent 82f6aa8 commit c54ba0b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions MediaManager/Platforms/Ios/Player/AppleMediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ protected virtual async void OnPlayerBoundaryReached()
{
await Pause();
Player.RemoveTimeObserver(playbackTimeObserver);
playbackTimeObserver = null;
}

public virtual async Task Play(AVPlayerItem playerItem)
Expand Down Expand Up @@ -276,7 +277,10 @@ protected override void Dispose(bool disposing)
});

if (playbackTimeObserver != null)
{
Player.RemoveTimeObserver(playbackTimeObserver);
playbackTimeObserver = null;
}

rateToken?.Dispose();
statusToken?.Dispose();
Expand Down

0 comments on commit c54ba0b

Please sign in to comment.