【发布时间】:2015-11-29 00:20:37
【问题描述】:
我正在开发一个 iOS 应用程序,它使用 AVPlayer 播放由 AVPlayerItems 表示的歌曲。
我尝试设置 MPNowPlayingInfoCenter.defaultCenter() 的 nowPlayingInfo 属性,但似乎该信息会立即被 AVPlayer 覆盖,因为它需要更新其他信息,例如 elapsedTime 和 PlaybackDuration。
甚至在程序执行后立即
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo?[MPMediaItemPropertyTitle] = "Title"
MPNowPlayingInfoCenter.defaultCenter().nowPlayingInfo的打印输出是
的信息:[ “MPNowPlayingInfoPropertyElapsedPlaybackTime”:34.89555007300078, “AVNowPlayingInfoControllerIdentifierKey”:<__ nsconcreteuuid> 9141DD1C-FD09-4210-B3C7-B948522E3AF6, “playbackDuration”:198.2516666666667, “MPNowPlayingInfoPropertyPlaybackRate”:1] P>
我做错了什么?是否可以在 AVPlayerItem 中存储其他元数据,例如标题/专辑名称,以便显示在信息中心?
另外,什么是 AVNowPlayingInfoControllerIdentifierKey?似乎没有任何名为 AVNowPlayingInfoController 的类。
【问题讨论】:
标签: ios swift avplayer mpnowplayinginfocenter