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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -