Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Finding the length of an audio recording in iPhone

I am recording the audio using avaudiorecorder. How do I find the length of the recording after saving the recording in a .caf file?

like image 554
Priyanka V Avatar asked May 23 '11 06:05

Priyanka V


1 Answers

You can use helpers in the CoreMedia framework.

AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:avAudioRecorder.url options:nil];
CMTime time = asset.duration;
double durationInSeconds = CMTimeGetSeconds(time);
like image 192
Deepak Danduprolu Avatar answered Sep 23 '22 19:09

Deepak Danduprolu