I'm using this开发者_运维问答 code for video streaming, and it's working fine. When a song is finished, it should return back on my home page, like the Mediaplayer.setOnCompletion
method.
VideoView videoView = (VideoView) findViewById(R.id.VideoView);
MediaController mc = new MediaController(this);
mc.setAnchorView(videoView);
mc.setMediaPlayer(videoView);
Uri video = Uri.parse(stream_url);
videoView.setMediaController(mc);
videoView.setVideoURI(video);
videoView.start();
How can I do this with MediaController
?
Try VideoView.setOnCompletionListener()
:
Register a callback to be invoked when the end of a media file has been reached during playback.
精彩评论