Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/102.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 当AVPlayer播放完一首歌曲后,如何隐藏远程指挥中心?_Ios_Xcode_Mp3_Avplayer_Mpremotecommandcenter - Fatal编程技术网

Ios 当AVPlayer播放完一首歌曲后,如何隐藏远程指挥中心?

Ios 当AVPlayer播放完一首歌曲后,如何隐藏远程指挥中心?,ios,xcode,mp3,avplayer,mpremotecommandcenter,Ios,Xcode,Mp3,Avplayer,Mpremotecommandcenter,我有一个用AVPlayer播放mp3的应用程序,我正在努力在曲目结束时隐藏远程指挥中心。这是设置我的远程指挥中心的功能 我怎么能把它藏起来 func setupRemoteCommandCenter(){ 您必须从远程控制事件中注销,并从mpnowplayingfocenter中清除当前播放信息: UIApplication.shared.endReceivingRemoteControlEvents() MPNowPlayingInfoCenter.default().now

我有一个用AVPlayer播放mp3的应用程序,我正在努力在曲目结束时隐藏远程指挥中心。这是设置我的远程指挥中心的功能

我怎么能把它藏起来

func setupRemoteCommandCenter(){


您必须从远程控制事件中注销,并从
mpnowplayingfocenter
中清除当前播放信息:

UIApplication.shared.endReceivingRemoteControlEvents()        

MPNowPlayingInfoCenter.default().nowPlayingInfo = [:]
您可以使用NotificationCenter观察者观察
AvPlayerItem
结束:

NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidPlayToEndTime(_:)), name: .AVPlayerItemDidPlayToEndTime, object: playerItem) 
NotificationCenter.default.addObserver(self, selector: #selector(playerItemDidPlayToEndTime(_:)), name: .AVPlayerItemDidPlayToEndTime, object: playerItem)