I'm just trying to play a local video that is a resource with the
MediaPlayer class in the most simple way possible. I have confirmed
that the video works with players that I download from the
marketplace, so I'm assuming that's not the issue.

The problem is that I just get a black screen with no video. There is
audio from the file playing though, so I know that the file resource
is being accessed correctly, it's just not showing anything on the
screen in the emulator.

The one other note is that at any time whenever I try to access
getVideoWidth() or getVideoHeight() I get this (non-blocking) error:

ERROR/MediaPlayerService(24): getVideoSize returned -1

Any ideas as to what I could be doing wrong?



import android.app.Activity;
import android.os.Bundle;
import android.view.SurfaceView;
import android.view.SurfaceHolder;
import android.media.MediaPlayer;

public class Example extends Activity {

   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);

       SurfaceView sv = new SurfaceView(this);
       setContentView(sv);

       SurfaceHolder holder = sv.getHolder();
       holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);

       new MediaPlayer();
       MediaPlayer mp = MediaPlayer.create(this, R.raw.video);
       //holder.setFixedSize(mp.getVideoWidth(), mp.getVideoHeight
());
       mp.setDisplay(holder);
       mp.start();
   }
}
--~--~---------~--~----~------------~-------~--~----~
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