【问题标题】:VideoView callback end videoVideoView 回调结束视频
【发布时间】:2018-09-03 05:35:00
【问题描述】:

我正在使用这段代码来播放视频:

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

但我真的很沮丧,因为我不明白如何附加回调来处理视频的结尾,我必须使用 Monodroid,然后是 C#

【问题讨论】:

    标签: android xamarin.android


    【解决方案1】:
     myVideoView.setOnCompletionListener(new OnCompletionListener() {
    
            @Override
            public void onCompletion(MediaPlayer mp) {
                // TODO Auto-generated method stub
    
               //write your code after complete video play  
            }
        });
    

    【讨论】:

      【解决方案2】:

      通过以下方式附加回调

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

      【讨论】:

        【解决方案3】:

        在 Xamarin.Android 中:

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

        【讨论】:

          猜你喜欢
          • 2012-08-19
          • 2022-12-02
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-02-23
          相关资源
          最近更新 更多