I have tried playing vimeo video using webview. But it doesn't look good, it makes the screen scrollable. Vimeo has suggested one more way to play using native playback, but it has specific requirements to use
The basic requirements for native playback are:
- User must be logged in.
- User must be the owner of the video.
- User must be PRO or higher (or the app must have the "can access owner's video files" capability).
- Token must have the video_files scope. User must be the owner of the API app making the request
I don't have PRO account. How can i use native playback just to test, if all goes well then i will go for vimeo PRO
THIS IS CODE WHICH I AM USING FOR PLAYING USING WEBVIEW
VimeoClient.getInstance().fetchNetworkContent(uri, new ModelCallback<Video>(Video.class) {
@Override
public void success(Video video) {
String html = video.embed != null ? video.embed.html : null;
if(html != null) {
WebView webView = (WebView) findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webView.loadData(html, "text/html", "utf-8");
}
}
@Override
public void failure(VimeoError error) {
Log.d(TAG, "failure: ");
}
});
}
Is there any other way to play the video?
In my case I used Exoplayer. Exoplayer is more customizable. All you need is to extract the url link from the config link. You may use retrofit to extract the video url.
BASE_URL = "https://player.vimeo.com/video/"
You will need to use a get method like below:
You will get the id from video link. Example: "https://vimeo.com/123456789/" Here the id is: 123456789 .
Now you can play using this url . Don't forget to initiate Exoplayer first.