tags:

views:

81

answers:

1

I am a beginner developer in android, I have a problem with playing video, It works with black screen I am using eclipse Galileo 3.5 with android 1.6 when I use android 2.2 it won't work at all !! Here is the code :

import android.app.Activity;
import android.graphics.PixelFormat;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class Video extends Activity {

 @Override
 public void onCreate(Bundle icicle) {
  super.onCreate(icicle);
  setContentView(R.layout.main);    
                VideoView videoView = (VideoView) findViewById(R.id.VideoView); 
                MediaController mediaController = new MediaController(this);
                mediaController.setAnchorView(videoView);
                // Set video link (mp4 format )
                Uri video = Uri.parse("android.resource://video/"+R.raw.boeing707crash);
                videoView.setMediaController(mediaController);
                videoView.setVideoURI(video);
                videoView.start();
 }
}

So what is the problem ?!

Thanks in advance.

+1  A: 

First, playing back video in the emulator requires a very fast PC (e.g., quad core).

Second, I have not tried playing back video from a resource. Try it from a file on your SD card and see if you have better luck.

CommonsWare