视频观看错误显示"无法播放此视频"一次又一次视频观看

时间:2017-08-11 07:35:49

标签: android android-videoview

我在Android视频视频中播放了一段视频。我无法停止此提醒"无法播放此视频"。我需要改变警告"抱歉!由于用户已停止直播,因此无法播放视频"

我使用了以下代码

 mStreamVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() {
       @Override
       public boolean onError(MediaPlayer mp, int what, int extra) {
           return true;
       }
   });

1 个答案:

答案 0 :(得分:1)

这里试试这个......

mStreamVideo.setOnErrorListener(new MediaPlayer.OnErrorListener() {

    @Override
    public boolean onError(MediaPlayer mp, int what, int extra) {
        AlertDialog.Builder build = new AlertDialog.Builder(this);
        build.setPositiveButton("OK", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });
        AlertDialog alt = build.create();
        alt.setMessage("Sorry! Unable to play the video due to user has stopped his live stream");
        alt.show();
        return true;
    }
});