Adrian Sicaru
Adrian Sicaru

Reputation: 1422

Can't run video in WebView on some devices

This is my first question so please be gentle...

Ok, here is the problem. I have to show a video inside a WebView in Android. I have tested it on multiple devices and Android versions and it does not work consistently.

I simply can't find the problem, nor a similar problem online...

This is a sample video I have to display:

<html>
<div style="display:none">

</div>

<script language="JavaScript" type="text/javascript" src="http://admin.brightcove.com/js/BrightcoveExperiences.js"></script>

<object id="myExperience2084424914001" class="BrightcoveExperience">
  <param name="bgcolor" value="#FFFFFF" />
  <param name="width" value="448" />
  <param name="height" value="282" />
  <param name="playerID" value="1628834100001" />
  <param name="playerKey" value="AQ~~,AAABCTwHZPk~,hTXeDm36Z7Rd3QTKipeWv6uC6OAmrw2j" />
  <param name="isVid" value="true" />
  <param name="isUI" value="true" />
  <param name="dynamicStreaming" value="true" />

  <param name="@videoPlayer" value="2084424914001" />
</object>

<script type="text/javascript">brightcove.createExperiences();</script>
</html>

And here is a sample of the WebView in Android...

try {
                        webviewC = (WebView) findViewById(R.id.webviewRSS);
                        webviewC.getSettings().setJavaScriptEnabled(true);
                        webviewC.getSettings().setDomStorageEnabled(true);
                        webviewC.getSettings().setSupportZoom(true);
                        webviewC.getSettings().setBuiltInZoomControls(true);
                        webviewC.getSettings().setUseWideViewPort(true);

                        // show loading progress in the title bar
                        webviewC.setWebChromeClient(new WebChromeClient() {
                            @Override
                            public void onProgressChanged(WebView view, int progress) {
                                activity.setProgress(progress);
                                // The progress meter will automatically disappear
                                // when
                                // we reach 100%
                                if (progress == 100) {
                                    setProgressBarVisibility(View.GONE);
                                }
                            }
                        });

                        // show message if error
                        webviewC.setWebViewClient(new WebViewClient() {
                            @Override
                            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                                Toast.makeText(activity, "Desole! " + description, Toast.LENGTH_SHORT).show();
                            }
                        });
                        webviewC.loadDataWithBaseURL("http://www.somebaseurl.org", aStringContainingHTML, "text/html", "UTF-8", "");
                    } catch (Exception e) {
                        Toast.makeText(activity, "Oh, no! " + e.getMessage(), Toast.LENGTH_SHORT).show();
                    }

UPDATE!

The video section I get must be displayed in a WebView (client request) and I get the html section I just posted from an XML flux, so there is no option there either...

Upvotes: 3

Views: 2097

Answers (1)

Brajendra Pandey
Brajendra Pandey

Reputation: 2274

It is possible that browser not support HTML5 tags for display and playing video.

Upvotes: 3

Related Questions