tags:

views:

50

answers:

2

I want to play any file for 6 seconds. Also suppose the audio is bigger then 6 sec the application will play only for 6 sec.and if it is less then 6 sec then play continuously. So is there any inbuilt option from any framework?

A: 

A Simple Way To Play MP3 Audio Files

KMan
A: 

Assuming you use an AVAudioPlayer, send a -stop message after 6 seconds:

NSTimer* timer = [NSTimer scheduledTimerWithTimeInterval:6
                               target:thePlayer selector:@selector(stop)
                                    userInfo:nil repeats:NO];

(Remember to invalidate the timer if the player stops early.)

KennyTM