开发者

How to play Next song Automatically when First one is finish?

开发者 https://www.devze.com 2023-04-10 19:23 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消