【发布时间】:2017-11-01 16:07:34
【问题描述】:
我正在尝试从应用外部控制我的音频播放器, 我开始了一个 av 音频会话,但它没有在后台播放(在 swift 3 上运行良好),
do{
myPlayer = AVPlayer(url: url!)
let audioSession = AVAudioSession.sharedInstance()
do {
try audioSession.setCategory(AVAudioSessionCategoryPlayback
)
do {
try audioSession.setActive(true)
}
}
catch {
print(error)
}
}
【问题讨论】:
-
使用
MPRemoteCommandCenter。比较:Play/Pause next/Prev buttons are greyed out in control center
标签: ios swift audio avfoundation