Hi, I want to play a MP3 which is on a distant server. What can i do to play the MP3 in a Iphone Application ?
A:
You could try AVPlayer. For example,
avPlayer = MonoTouch.AVFoundation.AVPlayer.FromUrl(new NSUrl("http://www.robtowns.com/music/blind_willie.mp3"));
avPlayer.Play();
Check out the MonoTouch or Apple documentation for more details.
dommer
2010-09-08 18:12:36
Cool it works only on the simulator. But I can't launch the application on my iphone :-(. Do you have an idea ? I use the last version of Monotouch
Kalonji
2010-09-10 08:47:01
What's happening on the iPhone? Error?
dommer
2010-09-10 09:57:06
On my iphone, i click on the application which crash. On my simulator i have no error
Kalonji
2010-09-10 13:10:30
Debug it on the iPhone using MonoDevelop and see if you get the error reported. Are you running iOS 4 on your phone?
dommer
2010-09-10 13:56:39
I have debuged my application on iOS 3 but I don't have more informations. Now i have upgraded my iphone on iOS 4 and my application work. I think we have a problem with the class AVPlayer on iOS 3.
Kalonji
2010-09-15 12:25:25
A:
The AVPlayer will work, if you want low-level access to the media pipeline, you can use the AVAudioFile APIs that let you stream the data yourself and then feed it to the audio decoders.
See my sample at:
http://github.com/migueldeicaza/monotouch-samples/tree/master/StreamingAudio/
This is a low-level API, just keep that in mind. The sample does its own file fetching from the remote site.
miguel.de.icaza
2010-09-14 15:06:43
At the beginning i used your samples. But after severals playing of mp3 the application block. I have tried with AVPlayer and now no problems.
Kalonji
2010-09-15 12:28:35