更改 MPNowPlayingInfo 字典,设置新参数
MPNowPlayingInfoPropertyPlaybackRate to 1.0f to show pause button
MPNowPlayingInfoPropertyPlaybackRate to 0.0f to show play button
从播放按钮到暂停按钮
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if(playingInfoCenter) {
NSMutableDictionary *songInfo = [NSMutableDictionary dictionaryWithDictionary:[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo];
//[songInfo setObject:songTitle forKey:MPMediaItemPropertyTitle];
//[songInfo setObject:songArtist forKey:MPMediaItemPropertyArtist];
[songInfo setObject:[NSNumber numberWithFloat:1.0f] forKey:MPNowPlayingInfoPropertyPlaybackRate];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = songInfo;
}
从暂停按钮到播放按钮
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if(playingInfoCenter) {
NSMutableDictionary *songInfo = [NSMutableDictionary dictionaryWithDictionary:[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo];
//[songInfo setObject:songTitle forKey:MPMediaItemPropertyTitle];
//[songInfo setObject:songArtist forKey:MPMediaItemPropertyArtist];
[songInfo setObject:[NSNumber numberWithFloat:0.0f] forKey:MPNowPlayingInfoPropertyPlaybackRate];
[MPNowPlayingInfoCenter defaultCenter].nowPlayingInfo = songInfo;
}