Reputation: 6246
I have some rough HTML coming from a website what I'm displaying in a WebView. In the HTML there's an iframe with a youtube video, and from what I've read they don't work. So my idea was to replace the iframe tag with an img tag (http://www.img.youtube.com/videoid/0.jpg) and make that a link to open the youtube app.
What would be the best way of me doing this? I tried using a replaceAll but it doesn't seem to be working.
if (mBundle.getString("youtubeKey") != null) {
String youtubeKey = mBundle.getString("youtubeKey");
sourceCode = sourceCode.replaceAll("/<iframe.*?</iframe>/si", "<img src='http://img.youtube.com/vi/"+youtubeKey+"/0.jpg");
Log.d("FUApp", "Replaced");
}
Upvotes: 1
Views: 4483
Reputation: 64
read this hopefully it will help you in both directions
How can we play YouTube embeded code in an Android application using webview?
Open youtube app from my android app. How to pass the id?
Upvotes: 1