I have an app which shows a HTML5 page with a video element in a WebView. It took me a while to figure out how to get the video working, but finally I succeeded to play the video embedded in a WebView on an Samsung Galaxy Tab (Android 3.1). I used the following code for the video tag:
<video controls poster="img/poster.jpg" height="240" width="360">
<source src="video/BigBuck.m4v">
<source src="video/BigBuck.theora.ogv" type="video/ogg">
<source src="video/BigBuck.webm" type="video/webm">
HTML5 video not supported.
</video>
The video element has multiple sources and now I'm trying to capture the selected video source (and format) before the video starts to play. When I click the play button, I see a HTTP request for the video file arriving at the web server where the video files are stored, but I don't succeed in intercepting this request at the app-side.
I looked at several methods to see whether the request for the video file passes there, but I didn't saw it pass in any of them.
- In
shouldOverrideUrlLoading(WebView view, String url)
in myWebViewClient
only the initial HTML5 page request passes. - In
shouldInterceptRequest (WebView view, String url)
in myWebViewClient
I see only passing the initial HTML5 page request and a request for the video poster image, but not for the video file. onShowCustomView(View view, CustomViewCallback callback)
in myWebChromeClient
is only called when I click the fullscreen control button on the HTML5 page when the video is already playing, but not when I click the play button. (What is actually the purpose of this method?)
Does anyone have a suggestion for another method where I can capture the request for the video file or can anyone explain me what actually happens when I click the play button on the video element?
shouldOverrideUrlLoading(WebView view, String url)
worked for me (in Gingerbread though). – Boris Strandjev