java - Android MediaPlayer Error Feedback -


i using mediaplayer in code play video.

this code :

mp.setdatasource(source); mp.setoncompletionlistener(this); mp.setonerrorlistener(this); mp.prepareasync(); 

in cases video not playing(and if call mp.getduration(); fail) , instead of getting onerror feedback getting oncompletion feedback, , can't know if problem occurs.

and times onerror function called.

any idea how can check if mediaplayer fail in oncompletion function?

according docs, onerrorlistener returns:

true if method handled error, false if didn't. returning false, or not having onerrorlistener @ all, cause oncompletionlistener called.

so oncompletion being called when onerror returns false.

your implementation of onerrorlistener should return true avoid oncompletion called.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -