EDIT Nevermind, YouTube released the Native Android API (https://developers.google.com/youtube/android/player/)
I have an application that shows an HTML5 videoview over a WebView. This video is forced to be HTML5 from YouTube service (http://www.youtube.com/embed/3FFyT039tJ0?autoplay=1&rel=0&showinfo=0&html5=1&start=90&end=176 )
As you can see in the URL, the parameter "start" shows the number of seconds the video must start playing at. I have been using the method onShowCustomView
of WebChromeClient
to obtain the VideoView
object created by the WebView, as seen here.
When I have the reference to the VideoView
, I can use the method seekTo()
to accomplish my goal. Till here everything is fine, but only for Android versions lower than 4.x.
As many of you know, the method onShowCustomView
of WebViewChromeClient
, from 4.x and forward, is only called when user clicks on "FullScreen" mode, but not when the video starts playing (how used to be before 4.x).
So, the point is that I can't seek 90 seconds forward because I can't obtain the reference to the VideoView, and I can't find any workaround.
YouTube now has a player API: https://developers.google.com/youtube/android/player/
Where you can easily place a view in the xml and handle it in activity, here are the examples: https://github.com/youtube/yt-android-player
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With