Search code examples
androidvitamio

Android Vitamio: How to disable default error alert?


I'm using Vitamio player in my app. I want to disable/change default alert on error saying "Sorry, this video cannot be played";

I can listen to error event with:

mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() {
            @Override
            public boolean onError(MediaPlayer mp, int what, int extra) {
                Toast.makeText(MainActivity.this, "Error", Toast.LENGTH_SHORT).show();
                return false;
            }
        });

but i couldn't find a way to disable default alert. I'm struggling to find any decent documentation/example about this topic, so I'm having a hard time finding solution. Any help will be appreciated, thanks!


Solution

  • You can disable it in the vitamio sources. In VideoView.java you will find the appropriate code. Search for AlertDialog (there should be only one) remove oder comment it out. And then in your own setOnErrorListener you can raise your dialog or toast.