Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

play youtube video in WebView

In my android app I have a WebView to display html data from our website. Sometimes the page will have youtube embed objects. This doesn't show up properly in the app. Is there any way to show/play youtube videos in WebView ? Thanks.

like image 626
Ionic Walrus Avatar asked Feb 18 '10 20:02

Ionic Walrus


2 Answers

You cannot show them embedded except perhaps on devices that have Flash.

However, if you can parse out the YouTube video details, you may be able to construct an ACTION_VIEW Intent that will show them on the YouTube application...for those Android devices that have the YouTube application.

You might also experiment with HTML5's <video> tag, which AFAIK is supported in the Browser application and may therefore work in WebView.

like image 60
CommonsWare Avatar answered Oct 10 '22 13:10

CommonsWare


I came accross this post: link

And indeed, I basically only needed to add to the application manifest xml:

android:hardwareAccelerated="true"

And voila, even the youtube video's started playing

like image 37
Ronnie Avatar answered Oct 10 '22 13:10

Ronnie