Can I play AAC file between 8m24s to 12m03s?

Discussion in 'iOS Programming' started by mikezang, May 26, 2013.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    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?
     
  2. weichsel macrumors newbie

    Joined:
    May 23, 2013
    #2
    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:
     
  3. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #3
    That sample is to show how playing file in Library, I want to play audio file in bundle? is there any sample?
     
  4. weichsel macrumors newbie

    Joined:
    May 23, 2013
    #4
    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"];
     
  5. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #5
    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?
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #6
    Perhaps you missed this part:

     
  7. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #7
    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?
     
  8. Duncan C, Jun 3, 2013
    Last edited: Jun 3, 2013

    Duncan C macrumors 6502a

    Duncan C

    Joined:
    Jan 21, 2008
    Location:
    Northern Virginia
    #8
    "...read .srt file and show it on images..."

    "play sound background base on contents of file .srt?"

    "any more detail suggestions?"

    That's some serious word salad you've got going there.


    Here's a suggestion. Learn to describe your problem well enough so others can understand it.

    Then do you own research, experiment with the things you find, and post CONCRETE, SPECIFIC QUESTIONS on the specific things you have having problems with.

    Don't post ill-formed questions look for others to do all your work for you.

    When you can't be bothered to even describe what you are doing clearly then why should others invest the time to play 20 questions with you to figure out what you are talking about, research the answer, and provide it to you?

    Edit: This guy puts it really well: What have you tried
     
  9. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #9
    Love it - saved to my read later and bookmarked. :D
     

Share This Page