I am playing video using AVPlayer
, it stops iPhone's music which is on going in background. Please help me to resolve
let item1 = AVPlayerItem.init(URL: NSURL(string:path))
player = AVPlayer(playerItem: item1)
layer?.player = player;
player?.play()
My movies are for animations; they have no sound. To let other sound continue playing, in Swift:
// None of our movies should interrupt system music playback.
_ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers)
Thanks to Marcus Adams for the original answer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With