Error when video file is plaed over a surface view

All your problems with Audio, Video and Images.

Error when video file is plaed over a surface view

Postby anngeorge » Thu Oct 22, 2009 10:02 am

Hi,

i have written the following code to display a video file on a surface view. the application stops unexpectedly when i try to run it in the emulator. I have the video file placed in the res/raw folder . Can someone tell me where i am going wrong?

public class CustomView extends Activity implements SurfaceHolder.Callback{
MediaPlayer mp;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);

final SurfaceView mediaSurface = (SurfaceView) findViewById(R.id.MediaSurface);
SurfaceHolder h = mediaSurface.getHolder();
h.addCallback(this);
mp = MediaPlayer.create(CustomView.this, R.raw.cdec);
mp.setDisplay(h);
}

@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
// TODO Auto-generated method stub

}

@Override
public void surfaceCreated(SurfaceHolder holder) {
// TODO Auto-generated method stub
mp.start();
}

@Override
public void surfaceDestroyed(SurfaceHolder holder) {
// TODO Auto-generated method stub

}
}
anngeorge
Developer
Developer
 
Posts: 36
Joined: Wed Sep 16, 2009 1:02 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 15 guests