Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

hemalimojidra

macrumors newbie
Original poster
Nov 7, 2008
24
0
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
 

vineetpatidar

macrumors newbie
Jan 13, 2009
1
0
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
 

hemalimojidra

macrumors newbie
Original poster
Nov 7, 2008
24
0
.mp3 file play

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

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.
 

hemalimojidra

macrumors newbie
Original poster
Nov 7, 2008
24
0

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
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];
 

hemalimojidra

macrumors newbie
Original poster
Nov 7, 2008
24
0
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];

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
 

hemalimojidra

macrumors newbie
Original poster
Nov 7, 2008
24
0
Can we play multiple .mp3 file at same time?

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];

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
 

kientt

macrumors newbie
Sep 25, 2008
1
0
about play mp3 file in Iphone

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

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
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.