Twitter Video Blockquote not rendering properly in Webview



I’m trying to show all the twitter blockquotes in a webview. The tweets are rendering properly. But, Twitter videos are not showing properly. Sometimes, it shows with the text along with a huge space and sometimes just the space. Below is my code used to load twitter blockquotes in a webview:

public static void showTweetsinWebview(String embedUrl, TweetViewContainer tweetContainer, LinearLayout container, BaseFragment.OnInlinelinkClickListner listener, Activity activity, Fragment fragment) {
        if (activity != null && container != null && fragment != null && embedUrl != null) {
            if (tweetContainer == null) {
                tweetContainer = new TweetViewContainer(activity);
            VideoEnabledWebview vWebview = initWebview(activity, fragment);
            ProgressBar progressBar = createDynamicLoader(activity, container);

            if (embedUrl != null) {
                String html = "<!DOCTYPE html><html> <head> \n" +
                        "\n" +
                        "<script async src =\"\" \n" +
                        "charset=\"utf-8\"></script></head>" +
                        " <body>" + embedUrl + "</body> </html> ";
                initWebviewListeners(vWebview, listener, progressBar, activity);
//                vWebview.loadDataWithBaseURL("", html, "text/html", "utf-8", null);
                vWebview.loadData(html, "text/html", "UTF-8");


Also, I tried testing the html content in W3Schools and even in this site, it is rendering properly. When the same code displays tweets properly, why videos aren’t rendering properly.


Is your embedUrl of the basic format:

<blockquote class="twitter-video"><a href=""></a></blockquote>

What CSP or sandbox values might be applied to the embed?


The blockquote has twitter-video. Plese find the below blockquote:

Happy Birthday @msdhoni! The more the candles the more the light that will shine in your life wish you all the best

- Suresh Raina (@ImRaina) July 7, 2016

It renders properly in web page. I tired it in W3 schools page. But it doens’t render properly in android webview.


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.