VideoView callback end video

北战南征 提交于 2019-12-23 15:39:58

问题


I am using this piece of code in order to play a video:

string videoUriString = "android.resource://" +  this.PackageName + "/" + Resource.Raw.video;
Android.Net.Uri videoURI = Android.Net.Uri.Parse(videoUriString);
video.SetVideoURI(videoURI);
video.Start();

But I am really frustrated because I don't understand how attach a callback for handle the end of the video, I have to use Monodroid, then C#


回答1:


 myVideoView.setOnCompletionListener(new OnCompletionListener() {

        @Override
        public void onCompletion(MediaPlayer mp) {
            // TODO Auto-generated method stub

           //write your code after complete video play  
        }
    });



回答2:


Attach the callback by

video.setOnCompletionListener(new OnCompletionListener() { ... });



回答3:


In Xamarin.Android :

video.Completion += delegate {
    Finish();
};


来源:https://stackoverflow.com/questions/13520977/videoview-callback-end-video

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!