2011-09-17 9 views
5

estoy usando a continuación el código para eso, pero cuando arrastra el regulador está llamando UPDATETIME método, pero atrapado en player.currentTime y no jugar másLa funcionalidad de búsqueda no funciona en AVAudioPlayer en la aplicación iPhone?

On single sliding of slider it gets stuck

-(IBAction)slide 
{ 
    [player setCurrentTime:slider.value]; 
    //NSLog(@"slider value in slide : %f",[slider value]); 

} 

    -(void) updateTime:(NSTimer *)timer 
    { 
     slider.value = player.currentTime; 
     //NSLog(@"player current time in update time : %f",[player currentTime]); 
     } 

    - (IBAction)play:(id)sender { 

     NSError *error; 
     NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"Sing_for_me.mp3" ofType:nil]]; 
     player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; 
     if(!player) NSLog(@"Error : %@",&error); 
     [player prepareToPlay]; 
     slider.continuous=YES; 

     slider.maximumValue = [player duration]; 
     //NSLog(@"player duration : %f",[player duration]); 
     // NSLog(@"slider duration : %f",slider.value); 
     //NSLog(@"player current time : %f",[player currentTime]); 
     slider.value=0.0; 

     [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(updateTime:) userInfo:nil repeats:YES]; 
     [player play]; 
    } 

lo que podría estar mal?

Respuesta

Cuestiones relacionadas