Remember my previous article on Let’s add a Video Stream Player to your Xamarin iOS App… ?😀 Do you remember? If not check it out! It’s pretty cool!😛
Anyways have you ever wanted to play a Vimeo video in your app?😉 Question is probably yes and if you were redirected from Google, then you are already looking for it. lol😀
The first time my boss asked me to do this, I was like.. huh? O.o Vimeo videos are played by streaming directly from their servers, how am I suppose to implement that in a mobile app, unless they have any 3rd party library, or adopt a bad practice such as implementing a web view to display the video with an embedded frame in it.
Yes it is a common requirement to attach an online video to your mobile app, such as from streaming giants as Youtube, Vimeo and etc. And for most of them have many third party libraries to consume their services such as streaming those videos, but only for native Mobile development.
But… what about Cross-Platform? ummm… Xamarin? :(
Well it’s not impossible, there’s always a way!😉
So today I’m gonna show you how you could play a Vimeo video in your Xamarin App.
First of all, if you haven’t implemented the Video player for your Xamarin app, then you may do as I did, Let’s add a Video Stream Player to your Xamarin iOS App (but that’s for Xamarin iOS) and you could find a tutorial for Xamarin Android right here,Video player implementation for Xamarin Android.
Little something about Vimeo Videos…
When you consider a Vimeo video, it surely has the capability for streaming…
And also you could retrieve a static endpoint of the actual Video Source with extension.
but in order to retrieve you need to be the administrator of the account that posted this video. So this URL endpoint is what we are going to be using for our Video Player.
In my situation I had to play the Vimeo video which was posted by an account which I had the administrator access. But I couldn’t find if there’s any other ways to retrieve the static endpoint url for the video without having admin access to the Video you need to play.
So keep in mind it is crucial you have the admin access for the Vimeo account which had posted the video.
First log into your Vimeo account. Go to the Video you want to be played in your Mobile App. Click on the “Settings” button at the bottom of the video, in order to access Settings.
Once you’re in the Settings section of that video, click on the “Video File” tab.
Which will take you to the properties of the actual Video file of your Vimeo Video. Now pay attention to the bottom of the page here, where you’ll notice the “Access your Video files” section.
Yep right there is your savior, which will provide you with the endpoint URL with the extensions for your video, specially in different kinds of quality, HD or SD or even Live Streaming link.
So for our requirement we are going to be using the High Definition or the Standard Definition, based on your choice. Go ahead and copy the URL and use it as the Video source for your Video Player implementation in Xamarin.🙂
Well that’s it! Simple as that!😉
Hope this helped someone not to waste hours and hours by trying to implement WebView Embedded player for playing a simple Vimeo Video.🙂