In my app I am using AudioStreamer to play a song through server,
I am refering this tutorial,
http://cocoawithlove.com/2开发者_JS百科008/09/streaming-and-playing-live-mp3-stream.html
How to play next song Automatically when using AudioStreamer?
In the tutorial is mentioned callback function which is triggered when a song finish playing. Your goal is to write functionality for your list of songs to move on the next one when this function is called.
void MyAudioQueueIsRunningCallback( void * inClientData, AudioSessionPropertyID inID, UInt32 inDataSize, const void * inData) { move to the next song }
I got answer,
In that tutorial there isplaybackStateChanged:(NSNotification *)aNotification method,
- (void)playbackStateChanged:(NSNotification *)aNotification
{
if ([songStreamer isWaiting])
{
}
if ([songStreamer isPlaying])
{
}
else if ([songStreamer isIdle])
{
[self playnextsong];
}
else if ([songStreamer isPaused])
{
}
}
When song completes through streaming, It going to idle state. So in idle state i call a method of playing next song.
And it Runs.
精彩评论