I'm creating a list of videos which are played within a VideoView
.
I want to catch the "Sorry, this video can't be played" error and just move on to the next video. The video-switching is handled within a onCompletionListener
.
I already got the code for an onErrorListener
from here but I just can't find how to trigger the "video is complete" event.
Any ideas?
You can do the same in the onErrorListener as you do in the onCompletionListener in onCompletion you set the video to the next one (somehow, i dont konw your implementation) then in on error use the same code (refactored into another function most likely). EG:
onError(....)
if(error = watever error you need)
functionNextVideo()
note the above is pseudo code.
But other than that onCompletionListener will not be triggered unless the video completes as it is supposed to.