streaming - How to update Song name shoutcast in iOS? -


i'm trying create iphone app station on shoutcast. i'm using streamingkit(https://github.com/tumtumtum/streamingkit) stream music i'm not sure how current song , artist name. has ever done before or knows how song name , artist?

edit: trying https://github.com/alvarofranco/afsoundmanager now.

you should registester kvo player this

[playeritem addobserver:self forkeypath:@"timedmetadata" options:nskeyvalueobservingoptionnew context:nil]; 

then use update ui:

- (void) observevalueforkeypath:(nsstring*)keypath ofobject:(id)object change:(nsdictionary*)change context:(void*)context {     if ([keypath isequaltostring:@"timedmetadata"])     {         avplayeritem* playeritem = object;          (avmetadataitem* metadata in playeritem.timedmetadata)         {             //assign metadata nsstring info             nsstring *info = [nsstring stringwithformat:@"%@", metadata.stringvalue];             mpmediaitemartwork *albumart = [[mpmediaitemartwork alloc] initwithimage:[uiimage imagenamed:@"poster.png"]];              nsmutabledictionary *nowplayinginfo = [[nsmutabledictionary alloc] init];             [nowplayinginfo setobject:[nsstring stringwithformat:@"now playing - %@", info] forkey:mpmediaitempropertyartist];             [nowplayinginfo setobject:info forkey:mpmediaitempropertytitle];             [nowplayinginfo setobject:albumart forkey:mpmediaitempropertyartwork];              [mpnowplayinginfocenter defaultcenter].nowplayinginfo = nowplayinginfo;              nslog(@"now playing: %@", info);              nsarray *metadata = [info componentsseparatedbystring: @"- "];              self.artist.text = [metadata objectatindex:0];             self.song.text = [metadata objectatindex:1];          }     } } 

note: playeritem instance of avplayeritem.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -