Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // How to get duration (HH:MM:SS) from AVAudioPlayer
- AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:@"you-url-sreaming"] error:nil];
- [audioPlayer prepareToPlay];
- CMTime duration = [[[audioPlayer currentItem] asset] duration];
- float seconds = CMTimeGetSeconds(duration);
- NSLog("Duration : %@", [NSString stringWithFormat:@"%02d:%02d:%02d", (int)((int)(seconds)) / 3600, (int)((int)(seconds)) / 60, (int)((int)(seconds)) % 60]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement