[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Marco Nelissen
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. - the way you create and use the SurfaceView,

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Marco Nelissen
On Sat, Feb 14, 2009 at 1:32 PM, Marco Nelissen 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 c

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Brendan
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.vi

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Marco Nelissen
On Sat, Feb 14, 2009 at 3:01 PM, Brendan wrote: > > 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: Oh, righ

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Brendan
Thanks for all your help! I've been trying out your original idea, but I still seem to be having issues. I have moved the SurfaceView to main.xml, it looks like this: http://schemas.android.com/apk/res/ android" android:orientation="vertical" android:layout_width="fill_parent" andro

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Marco Nelissen
I think you have to use the SurfaceHolder callbacks to find out when the surface has actually been created, and *then* call setDisplay/prepare/start On Sat, Feb 14, 2009 at 4:28 PM, Brendan wrote: > > Thanks for all your help! I've been trying out your original idea, but > I still seem to be hav

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-14 Thread Brendan
Wow, thank you for helping me through this. That was the little last little bit I needed. I finally got the video playing successfully by waiting until surfaceCreated to try calling prepare. Though I have to admit that it feels like a lot of code to just to play a video. Thanks again, I hope thi

[android-developers] Re: MediaPlayer plays sound but screen is black

2009-02-15 Thread Marco Nelissen
On Sat, Feb 14, 2009 at 9:48 PM, Brendan wrote: > > Wow, thank you for helping me through this. That was the little last > little bit I needed. I finally got the video playing successfully by > waiting until surfaceCreated to try calling prepare. > > Though I have to admit that it feels like a lo