vimeo video play in Android native
Asked Answered
U

3

12

I am developing vimeo video app in native android. But it is not supported in VideoView. May I know any samples or related query for Android. I want final output to be in .mp3/.mp4 format.

I have tried iframe in Android WebView, It works well in Android WebView but I am not able to get seek bar. And OnPause() not able to Pause the video. Here I am able to get Pause and Play button Only

enter image description here

Example: player.vimeo.com/video/49462103

I want play this video in android native

 <VideoView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/videoView"
    android:layout_centerVertical="true"
    android:layout_centerHorizontal="true" />

Update link in : Vimeo site Thread-1 Vimeo site Thread-2

enter image description here

I am getting above error

Unclean answered 20/2, 2016 at 8:20 Comment(3)
can you please share your code of webview, i am unable to even embed the vimeo video playerTented
@BhavikMehta did you find out how to embed vimeo video player?Unders
How to embed vimeo video ??Ampoule
F
9

I made a native player for vimeo, base by WebView. Support public and private video.

Try it : https://github.com/ct7ct7ct7/Android-VimeoPlayer

<com.ct7ct7ct7.androidvimeoplayer.view.VimeoPlayerView
    android:id="@+id/vimeoPlayer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"/>



VimeoPlayerView vimeoPlayer = findViewById(R.id.vimeoPlayer);
getLifecycle().addObserver(vimeoPlayer);

//public video
vimeoPlayer.initialize(59777392);

//If video is open. but limit playing at embedded.
vimeoPlayer.initialize({YourPrivateVideoId}, "SettingsEmbeddedUrl")

//If video is pirvate.
vimeoPlayer.initialize({YourPrivateVideoId},"VideoHashKey", "SettingsEmbeddedUrl")
Faiyum answered 18/1, 2019 at 10:59 Comment(3)
I checked your library its good. But can we change aspect ratio programmatically at runtime. For Example first time i will go with 1.334 <PORTRAIT> and then in fullscreen listener i wana change it back to default 1.778. But there is not method setAspectRatio ();Syncom
Unfortunately this great library does not work unless you are using an old version of Glide.Capitalization
is there any way to use vimeo videos in android java , this is not working with the latest version of glidePerjured
R
5

Vimeo's embed codes should work inside an Android WebView. Vimeo only offers .mp4 links to PRO users on those users own videos.

Another option is to use the official Deep Link library for the android application. This will let you open any vimeo video in the Android app.

Rabkin answered 22/2, 2016 at 0:28 Comment(10)
1. i have tried in webview but i am not getting access to seekbar bar to move forward or backword in mobile. you can see screeen shot above. Only pause and play is available 2. i am pro user but i am getting (player.vimeo.com/video/49462103) url from our server side. My question is how to authenticate this in android and i have to get .mp4 format to play in Android native Video view. Is there any Api to call this.Surmise
As you mention *Vimeo only offers .mp4 links to PRO users on those users own videos. How to Access this.. can i get sample or example to get .Mp4 format in android. Currently i am getting 49462103 Number to play video.Surmise
Finally i got one solution is this right way player.vimeo.com/video/123891946/config -- Get method. In response i will get .mp4 formatSurmise
That endpoint is not supported by Vimeo, and may break at any moment. The only supported method is through the Vimeo API, for PRO users to access their own videos. The video files are exposed via the api, in any video endpoint such as api.vimeo.com/me/videosRabkin
I am getting this error when i call above api { "error": "You must provide a valid authenticated access token." }Surmise
What is this?? Where i have to valid authenticated UserSurmise
I am not using Pro user account currently. But our client as taken Proaccount. If i Use Pro account user then i am getting Vaild Ouput???Surmise
@Unclean pls help me i am also getting same issue .... as i have used the link player.vimeo.com/video/69311033/config but how to play this link in android native ? so that i can get access of videos fullscreen button or fwd , back buttons ?Colewort
@Colewort u have to authenticate. ask server side people sent url. For them it easy to fetch and authenticateSurmise
can anyone post a sample or clear tutorial to embed VIMEO video to android native application.!!! ThanksAmpoule
C
2

You can use Exoplayer to play vimeo Videos. Exoplayer is more customizable. All you need is to extract the url link from the video 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:

@GET("{id}/{config}")
Call<JsonObject>getVideoLink(@Path("id") String id, @Path("config") String config);

You will get the id from video link. Example: "https://vimeo.com/123456789/" Here the id is: 123456789 .

 JsonObject jsonObject = response.body();
            JsonObject req = jsonObject.getAsJsonObject("request");
            JsonObject file = req.getAsJsonObject("files");
            JsonArray arr = file.getAsJsonArray("progressive");
            String url = arr.get(0).getAsJsonObject().get("url").getAsString();

           // Build the media item.
            MediaItem mediaItem = MediaItem.fromUri(url);
            // Set the media item to be played.
            player.setMediaItem(mediaItem);
            // Prepare the player.
            player.prepare();
            // Start the playback.
            player.play();

Don't forget to initiate Exoplayer first.

Cerelia answered 7/10, 2020 at 6:53 Comment(1)
For more detailed explanation on this check my answer here :- https://mcmap.net/q/1009335/-getting-video-files-value-null-while-integrating-with-vimeo-networking-java-library-to-play-the-video-by-uriSoekarno

© 2022 - 2024 — McMap. All rights reserved.