【发布时间】:2015-04-13 03:54:26
【问题描述】:
我们开发了一个跨平台的多媒体播放器。它使用 OpenAL 播放音频。在 iOS 上,我们想使用 MPNowPlayingInfoCenter 和远程控制事件的功能。
设置当前位置,经过时间,其他轨道信息效果很好。但是,不幸的是,当按下信息中心播放器中的暂停按钮时,播放器会暂停,但暂停按钮不会改变其状态。信息中心继续显示播放没有暂停(时间标签继续计数)。
我们这样处理 UIEventSubtypeRemoteControlPause 事件:
[self.player pause]; // Pause playback
// Update MPNowPlayingInfoCenter
NSMutableDictionary *mediaInformation = [NSMutableDictionary dictionaryWithDictionary:[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo];
mediaInformation[MPNowPlayingInfoPropertyPlaybackRate] = @0.0;
mediaInformation[MPNowPlayingInfoPropertyElapsedPlaybackTime] = @(self.player.currentTime);
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = mediaInformation;
MPNowPlayingInfoCenter 是否支持通过 OpenAL 播放音频或者我们错过了什么。
【问题讨论】:
标签: ios objective-c audio openal audio-player