I have a AAC file, I want to play it in my app, and I hope that I can play it from any time in any interval, is it easy and possible?
That sample is to show how playing file in Library, I want to play audio file in bundle? is there any sample?You could use AVFoundation to play your AAC file on iOS.
A good starting point is the AVPlayerDemo sample code from Apple:
http://developer.apple.com/library/...on/Intro.html#//apple_ref/doc/uid/DTS40010101
The above sample shows how to play back a video using AVPlayer. (AVFoundation also can be used to play audio-only files)
To accomplish your specific task (playing only a certain interval of a file), you can use AVPlayer's seekToTime method in combination with a time boundary observer:
http://developer.apple.com/library/...oundaryTimeObserverForTimes:queue:usingBlock:
NSURL* audioFileURL = [[NSBundle mainBundle] URLForResource:@"mediaFilename" withExtension:@"m4a"];
I have a lot of pictures and they divide d to groups, one group has a relevant AAC file, when a picture is showed, play specific segment in relevant AAC file, is this easy to implement?Just pass an URL to your media file to AVPlayer (using the AVPlayer initWithURL initializer).
You can obtain an URL to a resource within your main bundle via NSBundle.
e.g.:
Code:NSURL* audioFileURL = [[NSBundle mainBundle] URLForResource:@"mediaFilename" withExtension:@"m4a"];
I have a lot of pictures and they divide d to groups, one group has a relevant AAC file, when a picture is showed, play specific segment in relevant AAC file, is this easy to implement?
To accomplish your specific task (playing only a certain interval of a file), you can use AVPlayer's seekToTime method in combination with a time boundary observer:
http://developer.apple.com/library/...oundaryTimeObserverForTimes:queue:usingBlock:
Yeah, I read it.Perhaps you missed this part:
Yeah, I read it.
In fact, I want to read .srt file and show it on images and play sound background base on contents of file .srt, do you have any more detail suggestion?
"
Edit: This guy puts it really well: What have you tried