开发者

AudioStreamer appDelegate

I have tw开发者_JAVA百科o things concerning AudioStreamer and i hope I'm getting some clues here:

1. I have set up a UITabBarController and in my Appdelegate is a AudioStreamer-Object. Two views refer to the appDelegate.streamer. It it looks like that im getting two sessions when i release and alloc it new. I get two running audiosession.

2. I use a UITableView to play out of this list. in the didSelectRowAtIndexPath-method I initialize with a URL. when the user taps with a fast double, or tripple-click. the audiosession will get startet three times. although i'm using a bool to prevent that. so my dirty solution is to set the system sleeping for a second. it is ugly because the screen freezes for a sec.

Thankfull for some hints

Simon


In terms of your problems, it sounds like you should implement your AudioSteamer as a singleton, as this will prevent multiple instances from being created and provide a single point to control playback (i.e.: prevent multiple taps from triggering multiple playbacks).

For more information on how to create a singleton class, see the "Creating a Singleton Instance" section within Apple's Cocoa Fundamentals Guide.


for 2nd point. It is a bug of AudioStreamer class. Also this has been solved and code is put up on gitHub see link. also if this does not seems working then you can go to the pause method and add more states as below

-(void)pause
{
    if (state==AS_PLAYING || state==AS_BUFFERING || state==AS_WAITING_FOR_DATA)
    {
       //rest code goes same....
    }
    // rest code goes same....
}

this solved my same problem. Hope this will help you also...

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜