Using VideoView, how to remove “can't play this video” alert message?

后端 未结 1 1357
梦谈多话
梦谈多话 2021-01-01 19:07

Our app plays a set of videos, sometimes we are getting can\'t play this video alert message.

We are either playing video from sd card or streaming if that video is

相关标签:
1条回答
  • 2021-01-01 19:52

    Returning false or not having an OnErrorListener at all will cause the OnCompletionListener to be called.

    So return true instead of false from the function and no error will be shown, i.e.

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

    For more info see Android Document

    0 讨论(0)
提交回复
热议问题