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:
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
2010-04-05 08:03:00