Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isn't the audioPlayerDidFinishPlaying not being executed
    text
    copied!<p>I have this audioplayer piece of code and I do not know why the audioPlayerDidFinishPlaying is not being executed.</p> <p>Here is part of the code from my audioplayer.m file</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; NSError* e = nil; self.player = [[AVPlayer alloc] initWithURL:self.contentURL]; if(e) { NSLog(@"Detected error(%@)",e); } [self.playButton setImage:[UIImage imageNamed :@"Pause_40_40.png"] forState:UIControlStateNormal] ; [self.playButton addTarget:self action:@selector(stop) forControlEvents:UIControlEventTouchUpInside]; isPlaying = true; //Title of Music Screen //self.title = titleOfTheSong; //self.title = @"A Fixed Title"; MPVolumeView * volmueView = [[MPVolumeView alloc] initWithFrame:CGRectMake(60, 323, 200, 23)]; volmueView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin; [self.view addSubview:volmueView]; [[AVAudioSession sharedInstance] setDelegate:self]; e = nil; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:&amp;e]; NSLog(@"Error: %@", e); posUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:.1 target:self selector:@selector(timeCounterUpdate) userInfo:self.player repeats:YES]; [self timeCounterUpdate2:self.positionSlider.value]; [self.player play]; } - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag { NSLog(@"Finished"); if (flag == NO){ return; } [self.player pause]; [self.navigationController popViewControllerAnimated:YES]; } </code></pre> <p>I am setting the name of the avplayer to player in the viewDidload and then checking against that but it still does not seem to be called</p> <p>The audio stops playing but seems to still be operating the current position value does stop but the button still shows as if the audio still in the play mode if I pause it and then play it the current position simply continues to count passed the supposed end of the file.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload