开发者

How to perform action when streaming song completed?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜