dimmed
dimmed

Reputation: 47

How do i get the framelength of audio in android?

How do I get the framelength, and other stuff such as the framesize, channels, etc., of an audio file in android?

I tried using the MediaFormat but I thinks its for formatting an audio not getting the details from it. Also, is there a way to import a javax.sound library to android so that if there's no way in getting the framelength, I will just use the classes in javax.sound?

Upvotes: 0

Views: 208

Answers (1)

droid
droid

Reputation: 184

Try out this code

MediaPlayer mp = MediaPlayer.create(yourActivity, Uri.parse(pathofyourrecording));
int duration = mp.getDuration();

Upvotes: 1

Related Questions