I need to play youtube video in the webview,but when I load the URL the entire youtube mobile page is loaded. I want only a player or a way to embed the video in the webview, like in IOS. Is it possible? With the iframe tag the video doesn't load, it say that an error occurred. Thanks.
Asked
Active
Viewed 1.5k times
1 Answers
3
Use the Code to display an embedded Video in your Source for the WebView:
<iframe width="560" height="315" src="http://www.youtube.com/embed/...." frameborder="0" allowfullscreen></iframe>
You can find the URL for the src-Tag if you got to the Youtube Website and click on share -> embed.
But why do you use WebView? There you have to play the Videos in Flash. The Android VideoView can also stream Youtube Videos.

Thommy
- 5,070
- 2
- 28
- 51
-
I didn't know the Android VideoView can stream Youtube video! Thanks a lot :) – Andrea Mario Lufino Mar 05 '12 at 11:13
-
But, how can i do? I set the video path to my youtube url, but when i start the app a message shows "Impossible to play video". – Andrea Mario Lufino Mar 05 '12 at 11:36
-
Look at the answer to this question: http://stackoverflow.com/questions/5162088/video-view-not-playing-youtube-video (the one from Evgeny Nacu) – Thommy Mar 05 '12 at 11:58