视频网址无法在默认Android Media Player中使用。例如:
http://clips.vorwaerts-gmbh.de/VfE_html5.mp4
以上网址在Android的默认媒体播放器中无效。
答案 0 :(得分:0)
正在使用VideoView
VideoView videoview;
videoview = (VideoView) findViewById(R.id.VideoView);
try {
// Start the MediaController
MediaController mediacontroller = new MediaController(
VideoPlayActivity.this);
mediacontroller.setAnchorView(videoview);
// Get the URL from String VideoURL
Uri video = Uri.parse("http://clips.vorwaerts-gmbh.de/VfE_html5.mp4");
videoview.setMediaController(mediacontroller);
videoview.setVideoURI(video);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
videoview.requestFocus();
videoview.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
videoview.start();
}
});