开发者

How to perform action when streaming song completed?

开发者 https://www.devze.com 2023-03-31 02:48 出处:网络
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.

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

精彩评论

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