Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9125483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:48:52+00:00 2026-06-17T06:48:52+00:00

I want to load youtube video to Android webview using iframe here is my

  • 0

I want to load youtube video to Android webview using iframe

here is my layout Xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white"
android:id="@+id/mainLayout">

<WebView
    android:background="@android:color/white"
    android:id="@+id/webView"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" />
</RelativeLayout>

My code is:

public class WebTube extends Activity {

private WebView wv;

String html = "<iframe class=\"youtube-player\" style=\"border: 0; width: 100%; height: 95%; padding:0px; margin:0px\" id=\"ytplayer\" type=\"text/html\" src=\"http://www.youtube.com/embed/WBYnk3zR0os"
            + "?fs=0\" frameborder=\"0\">\n"
            + "</iframe>";

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    wv = (WebView)findViewById(R.id.webView); 
    wv.getSettings().setJavaScriptEnabled(true);
        wv.loadDataWithBaseURL("", html , "text/html",  "UTF-8", "");

     }
} 

Also I provide <uses-permission android:name="android.permission.INTERNET"/>

& android:hardwareAccelerated="true"

when I run this I didn’t get any result its just showing a black screen

I tried this .but this provide me video on .3gp Quality . but I need the videos from youtube on original quality. That’s why I am using iframe.

I try code using <object></object> and <video></video> instead of iframe. but it didn’t solve my issue.

when I run this code on emulator it shows

Before Pressing Play Button

iframe result on emulator

After Pressing Play button on video

iframe result on emulator on play button click

I think we cannot stream videos on emulator since it is a virtual device

But when I run this on phone it’s not even showing this result.

I try iframe with a document attach to it works fine on phone as well as emulator

String customHtml = "<iframe src='http://docs.google.com/viewer?url=http://www.iasted.org/conferences/formatting/presentations-tips.ppt&embedded=true' width='100%' height='100%' style='border: none;'></iframe>";

So please help me to load videos to this frame.

(I run it on phone). What’s the problem?
also will iframe work on Android 2.1?

did any one tried Youtube Api ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T06:48:53+00:00Added an answer on June 17, 2026 at 6:48 am

    As stated in the android Webview documentation,

    HTML5 Video support

    In order to support inline HTML5 video in your application, you need to have hardware acceleration turned on, and set a WebChromeClient.

    For full screen support, implementations of onShowCustomView(View, WebChromeClient.CustomViewCallback) and onHideCustomView() are required, getVideoLoadingProgressView() is optional.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to read/retrieve some details from a single YouTube video using: $sxml= simplexml_load_file(http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ);
I need to play youtube video in the webview,but when I load the URL
I want display a YouTube video playlist in a webview in my application. When
I need create WebView which can load a page from Youtube. I don't want
I want to download a couple songs off of http://www.youtube-mp3.org/ . I'm using urllib2
I want to load the form fields using json data. I am using extjs
I want to load data from MySql database to a HTTP form When I
i have a youtube video which I get its duration in seconds, I want
In iOS5 i want to load Youtube movies, and i done it with: -
I am using rich:dataTable with rich:dataTableScroller . And I don't want load all my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.