iphone - Do something when audio stops -


im wondering of how make app aware of when audio stops. have 30 minute audio recorded thats triggered when hit play button. play button changed pause button. pause button switch play button when audio complete. using avaudioplayer. how do this? thanks!

the avaudioplayerdelegate contains method called audioplayerdidfinishplaying:successfully:. override method , put play/pause button login in there.

something this:

in .h

#import <uikit/uikit.h> #import "avfoundation/avaudioplayer.h"  @interface viewcontroller : uiviewcontroller<avaudioplayerdelegate>  @end 

in .m

@implementation viewcontroller{     avaudioplayer *_player; }  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib.      _player.delegate = self; }    -(void)audioplayerdidfinishplaying:(avaudioplayer *)player successfully:(bool)flag{     //show play button }  @end 

more info on avaudioplayerdelegate here


Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -