Wow that sounds really convenient. Since the signature of the
MediaPlayer.create() that takes a SurfaceHolder requires the second
argument to be a URI and not a resource id, I tried creating a URI for
the resource by doing this:

Uri uri = Uri.parse("android.resource://com.example.www/" +
R.raw.video);

And this may be a total noob question, but is that the right way to
create a URI for a resource?
Because then when I passed it in like this:

MediaPlayer mp = MediaPlayer.create(this, uri, holder);

The app immediately closes after flashing up a black screen, with
these the last lines that the log gets:

INFO/ActivityManager(49): Process com.example.www (pid 642) has died.
DEBUG/Zygote(23): Process 642 terminated by signal (11)


On Feb 14, 1:35 pm, Marco Nelissen <[email protected]> wrote:
> On Sat, Feb 14, 2009 at 1:32 PM, Marco Nelissen <[email protected]> wrote:
> > Several things potentially wrong with your code:
> > - you're using MediaPlayer.create(), which calls prepare() for you. IIRC,
> > setDisplay() needs to be called *before* prepare(), so you won't be able to
> > use any of the MediaPlayer.create convenience methods.
>
> Scratch that. There's actually a version of MediaPlayer.create() that allows
> you to specify the SurfaceHolder. Use that one instead of the one you're
> using currently.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to