这是我的代码。在这个,如果我用视频网址启动意图它播放的同时它在视频中不播放是否有任何方法让它在VideoView中工作
VideoView mVideoView = new VideoView(this);
String videoURL = "video_url";
mVideoView.setMediaController(new MediaController(this));
mVideoView.setVideoURI(Uri.parse(videoURL));
setContentView(mVideoView);
当这位原生播放器播放视频时
Intent theIntent = new Intent();
theIntent.setDataAndType(Uri.parse(videoURL), "video/*");
我在设备上测试了这个
答案 0 :(得分:2)
尝试以下方式
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
// Set video link (mp4 format )
Uri video = Uri.parse("mp4 video link");
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.start();
参考此链接
https://stackoverflow.com/a/6410421/1441666
并检查支持的格式Android Supported Media Formats
答案 1 :(得分:0)
我认为这可能会有所帮助。
VideoView view = (VideoView) findViewById(R.id.xxxx);
MediaController mc = new MediaController(this);
mc.setMediaPlayer(view);
view.setMediaController(mc);
try{
view.setVideoURI(Uri.parse(file_path));
} catch(){
}
view.requestFocus();
try{
view.start();
}catch(){
}