1.在推流頁面或者播放頁面遵循設置 TXLiveAudioSessionDelegate.h 代理;
superPlayerView中
//設置 TXLiveAudioSessionDelegate 代理
[TXLiveBase setAudioSessionDelegate:self];
2.實現(xiàn)代理方法
- (BOOL)setCategory:(NSString *)category withOptions:(AVAudioSessionCategoryOptions)options error:(NSError **)outError;{
// 告訴app支持后臺播放
AVAudioSession *audioSession = [AVAudioSession sharedInstance];
[audioSession setActive:YES error:nil];
NSError *error ;
BOOL result = [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
return result;
}
3.接下來就是按照自己的需求來實現(xiàn)MPNowPlayingInfoCenter和MPRemoteCommandCenter
網(wǎng)上有很多請自行查找