AVAudioPlayer stops playing prematurely when setting currentTime on iOS6
| Originator: | yonix85 | ||
| Number: | rdar://12176192 | Date Originated: | 26-Aug-2012 |
| Status: | Closed | Resolved: | iOS7 beta 1 |
| Product: | iPhone SDK | Product Version: | 6.0 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
I'm trying to play an ADTS AAC file with AVAudioPlayer on iOS6, after setting the currentTime to an initial value.
This worked perfectly in my app when running on iOS <= 5, but in the latest iOS6 beta, the file would stop playing after a few seconds and the delegate will be informed the file was played successfully.
Steps to Reproduce:
Try to play an AAC ADTS audio file with AVAudioPlayer, after setting currentTime to any value (I used 2).
Example code:
self.player = [[AVAudioPlayer alloc] initWithData:[NSData dataWithContentsOfMappedFile:[[NSBundle bundleForClass:[self class]] pathForResource:@"file.aac" ofType:nil]] error:&error];
self.player.delegate = self;
[self.player prepareToPlay];
self.player.currentTime = 2;
[self.player play];
Expected Results:
The file would play from the point set until the end of the music without stopping.
Actual Results:
The sound stops playing after a few seconds, the player calls the delegate method:
- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag
with a successful flag
Regression:
In iOS <= 5 this code works (the file is played until the end)
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!