I think you have to make the second parameter a Uri with Uri.parse(yourPath);
Larry On Tue, Jul 24, 2012 at 7:51 AM, Dorien Herremans < [email protected]> wrote: > I generate a midi file and write it like this: > > File output = new File("exampleout.mid"); > > I think I might need to change this, so it is in the right folder (just a > readable/writable folder, perhaps Music/ ) > > > Next I want to play this midi file with MediaPlayer, but I cannot figure > out how to load the file. > > mediaPlayer = MediaPlayer.create(this, R.raw.test3); > > Only loads from the read only directory /res/raw. But if I try something > like: > > mediaPlayer = MediaPlayer.create(this, "file://exampleout"); > > It does not work because create needs an integer as input. I experimented > with AssetFileDescriptor, but haven't figured it out yet. > > > Meanwhile, I want to generate a new midi file and load it in mediaPlayer > (chained) to play when the first file finishes playing. > > MediaPlayer mediaPlayer = MediaPlayer.create(Activity.this,R.raw.a1); > mediaPlayer.setOnCompletionListener(new musicCompletionListener()); > mediaPlayer.start(); > private class musicCompletionListener implements OnCompletionListener { > @Override > public void onCompletion(MediaPlayer mediaPlayer) { > mediaPlayer.setDataSource(WHATTOPUTHERE) > mediaPlayer.release(); > } > } > > My Problem is really how to call the file. I cannot use strings apparently > (Unhandled exception type IOException), and the r.raw directory is not > possible due to its read only nature. I feel the solution is not so > difficult, but I am just easing into java from c++, perhaps just getting > some kind of file descriptor any help is much appreciated! > > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

