Situation
In my application I have a WebView
which loads its data inside an IFrame from an url.
Code Snippet:
String url = www.myexampleurl.com/video1.html;
String data = "<IFRAME SRC=" + url + " FRAMEBORDER=0 ... />";
WebView.loadData(data, MIME_TYPE, ENCODING);
The website itself, loads his video into a flash player and I simply display this in the WebView
. This works perfectly, with one nasty sidenote... Android has stopped supporting flash which means in the future my application will not work anymore by default. -Not acceptable!-
What I tried already
Solution to replace the flashplayer
I fetched the url of the video that is given to the flashplayer and I load it directly inside a VideoView
or WebView
with HTML5. These work solutions work! Perfect! But again a nasty sidenote.
The url (ex. www.myexampleurl.com/video1/video.mp4) is being generically created by the website (I think for each session). This means I don't have a consistent path to the video to load in my View
. The advantage of my first approach with the flashplayer inside the Webview
was that the flashplayer does all the work.
Solution to get the correct video-url
No serious problem yet, because I can tackle this problem too. I can do some PHP/DOM-scripting which would scrape the website for the video-url and give it back to my application. This way I always have the generic url and my video can be loaded inside my View
. Again that works! And again.. there is a sidenote..
I can not go directly to my website that has the flashplayer. The flow can be as followed:
The problem is that I get my video url only after step 3.
Question
Is there a way to solve my getting-the-generic-url problem? Or a better approach to play the video?
-- Is it bad, very bad or extremely bad practice to continue to support flash in Android? I can also just provide the flashplayer .apk and let users install it..
Thanks, hope someone can help me :)!
Don't do drugs. Don't do flash.
Get the file up on a server you have control of so you can give a proper path. If that is not an option, you'll have an app that can brake any moment the owner of the website decides to change something with the path.
Is parsing www.myexampleurl.com/video1.html the only way to fecth the url you want? Maybe you can do the PHP/dom stuff in the client instead of in your server: use an invisible WebView
to load www.myexampleurl.com/video1.html and try to get the url from it. WebViewClient::onLoadResource(WebView view, String url)
may be helpful (I am not sure). This task must be achievable by hacking WebView
, the problem is how complicated it will be.