public class VideoViewActivity extends Activity {
private String vSource;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.videoviewacti);
VideoView vView = (VideoView)findViewById(R.id.videovw);
vView.requestFocus();
String LINK = ConstantData.urlVideo;
Log.i("path of video",""+LINK);
vView.setVideoURI(Uri.parse(LINK));
//vView.setVideoPath("sdcard/test30fps.mp4");
MediaController mediacontroller = new MediaController(this);
vView.setMediaController(mediacontroller);
vView.start();
}
}
此处视频无法在模拟器中播放。它显示错误,如“无法播放视频” 视频格式是web服务上的mp4。 当它打开视频文件时,媒体播放器的控件将被禁用。