How to check audio has finished playing

Discussion in 'iOS Programming' started by electronica, Sep 29, 2011.

  1. electronica macrumors newbie

    Joined:
    Sep 24, 2011
    #1
    hmm is there any easy way to check if the playing audio is finished?

    i need to call a method when the audio is finished playing.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Perhaps you could explain, in detail, how you started the audio playing in the first place.
     
  3. electronica, Sep 29, 2011
    Last edited by a moderator: Sep 29, 2011

    electronica thread starter macrumors newbie

    Joined:
    Sep 24, 2011
    #3
    ok, sorry
    this is my code, and when the mp3 file is finished playing, than i want to call ileri method again. thats all.
    Code:
    -(IBAction)ileri
    {
        
    NSString *path = [[NSBundle mainBundle] pathForResource:[sesarray objectAtIndex:deger - 1] ofType:@"mp3"];                       
    theAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];   
    theAudio.delegate = self;                                                                           
    [theAudio setVolume:2.0];
        
    [theAudio play];
        }    
    }
    
     
  4. jiminaus macrumors 65816

    jiminaus

    Joined:
    Dec 16, 2010
    Location:
    Sydney
    #4
    Have a look at the AVAudioPlayerDelegate protocol reference.
     

Share This Page