I'm trying to play a mp3 file with using AVAudioPlayer
:
NSString *path = NSString stringWithFormat:@"%@/%@" ,
[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
NSURL* url = [NSURL fileURLWithPath:path];
AVAudioPlayer* player = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: nil];
[player play];
NSLog(@"%f/%f", player.currentTime, player.duration);
However, the player stops around 478.558367 every time even though its duration is 1044.437506. Why does the player stop in the middle of the track?