Reputation: 31
It would be very interesting for me to have the methods below available for the Youtube Android API:
player.getVideoLoadedFraction():Float
As I can see in the YouTube player API for Javascript (iframe) these methods are included.
These methods are very useful to get the statistics of the buffer while a video is being played
Has anyone figured out a way to include these methods in the Youtube android api as well?
Upvotes: 2
Views: 367
Reputation: 131
As far as I know there is no way to do that (maybe with reflection you are able to hack out some relevant information but you have to reverse engineer of the obfuscated code for that).
I tried a simple workaround for that result:
evaluateJavascript()
method, which takes a String
argument that pass to the called Javascript method. After the Javascript method completed his job, you are able to pass the result (in string format) to the Java caller.More: https://developer.android.com/guide/webapps/webview.html
With these technics, you are able to calculate the buffer size in seconds for example: (VideoLoadedFraction - (current_time / video_length) * 100) / 100) * video_length
or something like that. Then you pass back the result from Javascript as a string and parse it to float or double in Java.
Upvotes: 1