我正在使用 AVPlayer
播放视频,它会停止 iPhone 在后台播放的音乐。请帮我解决
let item1 = AVPlayerItem.init(URL: NSURL(string:path))
player = AVPlayer(playerItem: item1)
layer?.player = player;
player?.play()
最佳答案
我的电影是动画片;他们没有声音。要让其他声音继续播放,在 Swift 中:
// None of our movies should interrupt system music playback.
_ = try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playback, mode: .default, options: .mixWithOthers)
感谢 Marcus Adams 的原始答案。
关于ios - 当使用 AVPLayer 播放视频时,它会停止背景音乐 ios,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29513947/