Set nowplayingInfo to show song title, artist on air (apple tv), not work
I'm looking for everything about setting up a composition for broadcast, it looks just like that, but I still can't improve my application.
I am using MPMoviePlayerController to play audio. And I also read the AirPlay review at developer.apple.com.
I have set the following code in my opinion
- (BOOL) canBecomeFirstResponder {return YES;}
- (void) viewDidAppear: (BOOL) animated {
[super viewDidAppear:animated];
[ [UIApplication sharedApplication] beginReceivingRemoteControlEvents];
[self becomeFirstResponder];
}
- (void) remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {
if (receivedEvent.type == UIEventTypeRemoteControl) {
switch (receivedEvent.subtype) {
case UIEventSubtypeRemoteControlTogglePlayPause:
// [self playPauseToggle: nil]
break;
case UIEventSubtypeRemoteControlNextTrack:
[self nextTrack: nil]
break;
}
}
and also install nowplayinginfo before playing music (tried installing this after playing music)
NSMutableDictionary *airPlaySongInfo = [[NSMutableDictionary alloc]init];
[airPlaySongInfo setObject:@"hihi title"] forKey:MPMediaItemPropertyTitle];
[airPlaySongInfo setObject:@"hihi artist"forKey:MPMediaItemPropertyArtist];
[airPlaySongInfo setObject:@"hihi album" forKey:MPMediaItemPropertyAlbumTitle];
[airPlaySongInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:airPlaySongInfo];
and I set background to play audio in plist.
but there is no title, artist or album on my tv. Did I miss something? or is there something conflicting?
I have the same problem....
I registered via KVO on AVDlayerItem timedMetadata, but as soon as I play on AppleTV I don't get any more notifications as a watcher.
Thanks so much for any answers that might help.