I am builting an iOS app that streams shoutcast audio.
I want to display a custom image on the device lockscreen (no matter the song, I want the same image to be displayed).
The code bellow shows me the current title on the lockscreen, but does not display the album art like the image just bellow.
Is possible first (I think, Mixcloud achieves it) ? If yes, what is wrong with this ? Source here.
Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
UIImage * albumImage = [UIImage imageNamed: @"icon_HD.png"];
MPMediaItemArtwork * albumArt = [[MPMediaItemArtwork alloc] initWithImage:albumImage];
[songInfo setObject:titre.text forKey:MPMediaItemPropertyTitle];
[songInfo setObject:artiste.text forKey:MPMediaItemPropertyArtist];
[songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];
}
MPMediaItemArtwork
that I set can be retrieved from thenowPlayingInfo
dictionary and can be seen by with FB chiselvisualize (UIImage *)[0x7ffd7a4a8d20 imageWithSize:CGSizeMake(128, 128)]
Also is anyone aware of the size the images need to be for lock screen artwork display? – Parish