Nav Link On

iPhone Dev Forums > General Development > SDK Coding Help > AVAudioPlayer doesn't start back up after interruption

Reply

 

LinkBack Thread Tools Display Modes
Old 02-27-2009, 06:39 PM   #1 (permalink)
Junior Member
 
slugolicious's Avatar
 
Join Date: Feb 2009
Posts: 3
Default AVAudioPlayer doesn't start back up after interruption

This is somewhat related to my previous post but it's a different question.

After I return from audioPlayerEndInterruption(), I want to start my audio back up. I have a UIButton that I toggle with an image of a play button and a pause button. For fun, I press play then immediately press it again to pause, in quick succession. As in my previous post, I also have a timer that starts when I play. In this quick case, the timer is set up but the selector/callback is never called because I pause the playback too quickly (and in my pause handler, I invalidate the timer).

I kind of expect that. My timer is set for 1 second intervals and I hit pause before one second had passed. Fine.

Now I want to play again, for real. I call [player play] but I get back a bad return code.

Code:

You must Login or Register to view and contribute code! This is done to increase participation in helping one another out, if you have been helped please pass on the favor.

   BOOL rc = [player play];
   if (!rc)
   {
      NSLog(@"Holy Schmokes!  We can't play!");
   }
(Notice the return code is a bit backwards. You get YES (1) if the play was successful and NO (0) if not. I typically expect a non-zero return code on failure, but that's beside the point. I could probably call my variable 'success' instead of 'rc' and then check success == NO).

Anyway, there are no other indications why my player won't play anymore. It was playing fine before my quick play/pause interaction.

I print a message in audioPlayerDecodeErrorDidOccur() just in case but nothing happens. (Didn't expect a message anyway since it had started playing ok.)

If I query the various properties of the player (currentTime, duration, etc), they all look normal. The currentTime is 5.8 seconds because that's when I paused it last.

Is there any other way to diagnose why the player won't play?
slugolicious is offline   Reply With Quote
Reply

iPhone Dev Forums > General Development > SDK Coding Help


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC1