adBODKAt
adBODKAt

Reputation: 75

audio stream duration in ios

I'm using AVAudioPlayer for playing audio stream(download stream into buffer and play it).
I need to know how to disable reading some id3 tags by AVAudioPlayer class, because i need duration of loaded data, not all-file duration. Or maybe someone know how to get duration of loaded data.
PS. Buffer filling while playing.

Upvotes: 1

Views: 1313

Answers (1)

san
san

Reputation: 3328

Try following code to get the duration.

// get the URL of the sound file to be played
    AVURLAsset* audioAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:audioPath ] options:nil];
    // get the duration of sound to be played in seconds 
    CMTime audioDuration = audioAsset.duration;

Following imports may be required:

1) #import <AVFoundation/AVFoundation.h>

2) CoreMedia framework for CMTime

Upvotes: 1

Related Questions