问题
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);
VideoView videoView = (VideoView) findViewById(R.id.video_view);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(link);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.start();
}
But not successful. It's giving an error: "Cannot play this video"
回答1:
I guess you did not use
<uses-permission android:name="android.permission.INTERNET" />
Did you?
来源:https://stackoverflow.com/questions/6277375/play-movie-from-url-on-android