I faced the same issue.
Video freezes and audio continues to play
I fixed by adding this line try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
my code for reference:
try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback)
if self.playerLayer != nil {
self.playerLayer?.removeFromSuperlayer()
self.playerLayer = nil
}
self.playerLayer = AVPlayerLayer(player: self.player)
self.playerLayer?.videoGravity = .resize
self.player = AVPlayer(url: videoUrl)
self.playerLayer?.frame = self.view.layer.bounds
addObserversVideoItem(myCustomVideoItem)