Thank you for providing a copy of your project. On Nov 16, 2012, at 1:58 PM, Jonathan Pryor <j...@xamarin.com> wrote: > On Nov 16, 2012, at 1:41 PM, JM_SH <juanmanuelsanch...@gmail.com> wrote: >> and I have errors in both (an exception Java.IO.IOException). > > What's the full stack trace of the exception?
I/MonoDroid( 9239): UNHANDLED EXCEPTION: Java.IO.FileNotFoundException: Exception of type 'Java.IO.FileNotFoundException' was thrown. ... I/MonoDroid( 9239): java.io.FileNotFoundException: /PruebaAudio2/PruebaAudio2/Resources/Raw/disparo.mp3: open failed: ENOENT (No such file or directory) The problem is that the file /PruebaAudio2/PruebaAudio2/Resources/Raw/disparo.mp3 doesn't exist. You need to use filesystem paths which relative to your application's directory; your app is not installed into the root folder. Furthermore, Android Resources are _not_ extracted from the .apk during installation, so your diasporo.mp3 file isn't accessible as a file anyway. You need to access Android Resources through their Resource IDs, as suggested earlier in the thread. Also of note is the state diagram [0]. MediaPlayer.create() places the MediaPlayer into the Prepared state, and (as per the docs) Prepare() should not be called again. Since we can't call Prepare() again, we can't call Stop() either (as the only way to get back to a Started state from Stopped is through Prepare()), so we can either re-create MediaPlayer instances, or use Pause() and SeekTo(), as is done here: public void strtPlayer() { try { if (player == null) { player = MediaPlayer.Create (this, Resource.Raw.disparo); } else { player.Pause (); player.SeekTo (0); } player.Start(); } catch (Exception ex) { Console.WriteLine ("Error! {0}", ex); } } - Jon [0]: http://developer.android.com/reference/android/media/MediaPlayer.html _______________________________________________ Monodroid mailing list Monodroid@lists.ximian.com UNSUBSCRIBE INFORMATION: http://lists.ximian.com/mailman/listinfo/monodroid