问题
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