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.PixelFo开发者_JS百科rmat;
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.
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.
Android video view is displaying a big black screen when opening a video for first time before playing for 1 to 2 secs.Video is playing working fine.But how to disable that black screen while playing the video.
I am using the following snippet of code.
videoView.setVideoURI(data);
videoView.start();
//data is my uri
Regards,
Bhavani.
精彩评论