我已经成功地使用AVPlayer流式传输MP3。我实现了一个MPVolumeView来支持AirPlay,它很好用,但是我注意到我的Apple TV上的标题信息并未显示来自流媒体MP3的任何内容,而只是“未知”信息。是否有办法从应用程序中控制此信息,或者这是由于流媒体MP3引起的问题?非常感谢您的帮助!
我已经成功地使用AVPlayer流式传输MP3。我实现了一个MPVolumeView来支持AirPlay,它很好用,但是我注意到我的Apple TV上的标题信息并未显示来自流媒体MP3的任何内容,而只是“未知”信息。是否有办法从应用程序中控制此信息,或者这是由于流媒体MP3引起的问题?非常感谢您的帮助!
我希望更新这个问题,以便其他人需要在AirPlay期间控制他们的Apple TV上看到的内容。 这个功能适用于iOS5,但下面的代码示例将在包括iOS4支持的应用程序上正确编译。
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
UIImage *albumArtImage = [UIImage imageNamed:@"Album-Image-Name.png"];
MPMediaItemArtwork *artwork = [[MPMediaItemArtwork alloc] initWithImage:albumArtImage];
MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter];
NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys:
@"Artist Name", MPMediaItemPropertyArtist,
@"Title Name", MPMediaItemPropertyTitle,
@"Album Name", MPMediaItemPropertyAlbumTitle,
artwork, MPMediaItemPropertyArtwork,
nil];
center.nowPlayingInfo = songInfo;
}
当您调用媒体播放器(如AVPlayer)的play方法时,所有设置都会完成。