Skip to content

Instantly share code, notes, and snippets.

@TjWallas
Created April 22, 2013 06:59
Show Gist options
  • Save TjWallas/5432924 to your computer and use it in GitHub Desktop.
Save TjWallas/5432924 to your computer and use it in GitHub Desktop.
Embedding Vimeo Videos using WebView on Android
//Auto playing vimeo videos in Android webview
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
// how plugin is enabled change in API 8
if (Build.VERSION.SDK_INT < 8) {
mWebView.getSettings().setPluginsEnabled(true);
} else {
mWebView.getSettings().setPluginState(PluginState.ON);
}
mWebView.loadUrl("http://player.vimeo.com/video/24577973?player_id=player&autoplay=1&title=0&byline=0&portrait=0&api=1&maxheight=480&maxwidth=800");
@gquemener
Copy link

Hi,

Could you tell me if your solution allows to have access to the play, seek, playProgress, ... events of the player which are not supported on "Mobile" (I've tried in Firefox Mobile and Chrome Mobile, and these events are indeed not triggered).

See https://developer.vimeo.com/player/js-api#event-compatibility

Thanks in advance.

@YugankaS
Copy link

Can somebody answer? I'm facing a similar problem as gquemener above. The pause/play button is there but there is no seek bar and no icon to change the quality of streaming (from 270p to 360p etc), when displaying a vimeo video in a webview.

@dougouk
Copy link

dougouk commented Nov 14, 2017

On my device, the default Vimeo seekbar is present

@rajesh-codes
Copy link

I used the code given by @TjWallas . The app playing only sound without video. It is showing only black screen in the web view. Please help me with this.

@MrAndrew
Copy link

MrAndrew commented Dec 8, 2018

This just opens the video in the browser when I tested it. Then again it has been 6 years...

@MrAndrew
Copy link

MrAndrew commented Dec 8, 2018

I used the code given by @TjWallas . The app playing only sound without video. It is showing only black screen in the web view. Please help me with this.

^This maybe because you are using an emulator. Try using the latest APK with hardware acceleration turned on and/or a real device.

@sandeepyohans
Copy link

The code is outdated.
This method was deprecated in API level 18. Plugins are not supported in API level Build.VERSION_CODES.KITKAT or later; enabling plugins is a no-op.
Check link:
public abstract void setPluginState (WebSettings.PluginState state)

@sergiobarbieri
Copy link

Hi, any tips for enabling full screen???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment