Develop player to play .mp3 file in iphone

Discussion in 'iOS Programming' started by hemalimojidra, Jan 12, 2009.

  1. macrumors newbie

    Joined:
    Nov 7, 2008
    #1
    Hi friends,
    I am not getting how to play .mp3 file in iphone. I want to develop a player that can play multiple .mp3 file in iphone. And also want to control volume of that file.Is there any online tutorial or else that can help me to solve my problem?

    Hopefully...
    Hemali
     
  2. macrumors regular

    Joined:
    Mar 24, 2008
    #2
    I think it is against the rules to develop a competing Apple application.
     
  3. macrumors newbie

    Joined:
    Jan 13, 2009
    #3
    Hi Hemali,

    I am also facing same problem, can you help me how are you going to sloving this issuse, are you using Audiotoolkit framework(Speak here) example. or you know it other way

    Thanks

    Vineet
     
  4. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
  5. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #5
    .mp3 file play

    Hello vineetpatidar,
    Yes i am also using this application (Speak here) for reference and oalTouch application. And also using AudioToolkit Framwork. But can not play .mp3 file.

    Thanks,
    I can play .aif, .caf, .wave file. But i can not play .mp3 file.


    i have change the file type in code is
    ///////
    OSStatus result = AudioFileOpenURL (
    (CFURLRef)audioFileURL,
    0x01,
    kAudioFileMP3Type,//
    &audioFileID
    );

    NSLog(@"openPlaybackFile File Statud :%@",result);
    ////////////
    And also change the buffersize in code.

    But can't play .mp3 file. Bcoz it is vbr(Variable bitrate file formate) file.

    If you get ant solution than please help me.
     
  6. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #6
  7. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #7
    First link I posted mentions "mp3" almost a dozen times...

    Code:
    #import <AVFoundation/AVFoundation.h> 
    
    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"foo" ofType:@"mp3"]]; 
    audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil];
    [audioPlayer play];
     
  8. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #8
    Hello jnic,
    i have already Use this framwork. But this AVFoundation is awaylable with iphone-os-2.2. and mac-os-10.5.5. I have this sdk2.2(iphone os-2.2) but i have not that mac-os-10.5.5. that's way i couldn't compile it with my sdk and my mac. Have you any idea related to this? Have you face this kind of problem? If you have any idea related to this than please help me. I have mac-os-10.5.5 update but using this my mac-os is being corrupted. If you know this problem than also please reply me.

    From where i can solve my this type of probleme?

    hopefully;
    Hemali Mojidra
     
  9. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #9
    How it is against the rules to develop a competing Apple application?
     
  10. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #10
    Read the SDK agreement. There are rules somewhere around section 3.3.

    .
     
  11. macrumors 603

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #11
    Not every app that plays mp3's is a competing app. Most games with built-in mp3 background music for instance.

    .
     
  12. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #12
    Yes I got it.
    Thank you.
     
  13. thread starter macrumors newbie

    Joined:
    Nov 7, 2008
    #13
    Can we play multiple .mp3 file at same time?

    Thank you jnic,
    I have read your all post related to this and finally i can play .mp3 file.
    I have use MediaPlayerFramework to play .mp3 file.
    I have still probleme with AVFoundation FrameWork.If you get solution than please reply. Waiting.....:)


    Can we play multiple .mp3 file at same time?
    I think No.. But if you know than plz tell.

    Thank you,
    Hemali mojidra
     
  14. macrumors newbie

    Joined:
    Sep 25, 2008
    #14
    about play mp3 file in Iphone

    Hi all!
    You can add this code in .mm file bellow:

    if (audioFormat.mBytesPerPacket == 0 || audioFormat.mFramesPerPacket == 0) {
    packetDescriptions = (AudioStreamPacketDescription*)malloc(
    numPacketsToRead * sizeof(AudioStreamPacketDescription)
    );
    } else {
    packetDescriptions = NULL;
    }

    I have try and very good,
    best regards
     

Share This Page