1

I am developing a android application in which, i have to play a vimeo video. Video is given in the form of an URL. I want to load it in a webview. I tried it, but the video is not playing. I got a still picture of video, but it is not playing,

videoPlayer = (WebView) findViewById(R.id.videoPlayer);   

    WebSettings webViewSettings = videoPlayer.getSettings();
    webViewSettings.setJavaScriptCanOpenWindowsAutomatically(true);
    webViewSettings.setJavaScriptEnabled(true);
    webViewSettings.setPluginsEnabled(true);
    webViewSettings.setBuiltInZoomControls(true);
    webViewSettings.setPluginState(PluginState.ON); 
    videoPlayer.loadData("<iframe src=\</**HERE COMES VIDEO LINK*/>width=\"1280\" 
                           height=\"720\" frameborder=\"0\" 
                           webkitAllowFullScreen mozallowfullscreen 
                           allowFullScreen></iframe>", "text/html", "utf-8");

can anyone tell me where i gone wrong? or Vimeo video cannot be played on Android. Is there any vimeo player plugin or anything like flash player for Android or can anyone suggest me any other solution for this problem?

3

2 Answers 2

1

Try doing something like this for a youtube normal video link..it works for me :

        String videoPoP = "http://www.youtube.com/v/A6kCkkLo6Rw?";
        webview.getSettings().setJavaScriptEnabled(true);
        String widthAndHeight = "width=\"" + widthdp + "\" height=\"" + heightdp + "\"";            

        String temp = "<object "
                + widthAndHeight
                + ">"
                + "<body style='margin:0;padding:0;'>"
                + "<param name='allowFullScreen' value='false'>"
                + "</param><param name='allowscriptaccess' value='always'>"
                + "</param><embed src='"
                + videoPoP
                + "'"
                + " type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true'"
                + widthAndHeight + "></embed></object>";

        webview.loadData(temp, "text/html", "utf-8");

The following code should work for a vimeo video as well. so try and see

0

I'm stuck with the same problem. As mentioned in the documentation:

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

More Infos here: http://developer.android.com/reference/android/webkit/WebView.html

However, it's not working on all devices, especially those with Froyo. I'm still trying to find a workaround (at least for Dailymotion and Vimeo videos)

2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.