Get Vimeo Video Permanent Link with API in Laravel

Author - Happy

Getting Vimeo link and status

Vimeo is a video sharing (raised, flat supporting surface) in which users can upload, share and view videos.

There are several plans for storage limit to upload videos on Vimeo.

You can upload your own innovative videos for others to appreciate and peruse through the accessible videos on the stage to watch ones from different makers.

You can access your video URL from your Vimeo account.

But if you are storing your video in Vimeo server then it’s not feasible to get a link from Vimeo account.

In that case, you can request for your video link using Vimeo’s built-in API. In laravel, you can use Vimeo’s API for uploading video or fetching video detail.

$response = Vimeo::request($video_id, array(), "GET");

$status = $response["body"]["status"];

$link = $response["body"]["files"][0]["link"];

Getting permanent video link

In above API video_id is an id for which you are requesting to get video detail.

It will request Vimeo to get detail for a given id.

If your video uploaded in Vimeo server then you can get a permanent link.

To check whether your video uploaded or not you can check the status of your video from the response.

$status  will return the current status of your video whether it is uploading or uploaded successfully.

If your video uploaded successfully then it will return “Available” and now you can get your link

This will return the video link and you can use $link to access video URL

In response, there are numerous links yet that will expire after some time, so I have discovered a permanent solution, for that see below code.

If you want the video for a specific size or quality you can use it like this:

foreach($response["body"]["files"] as $file){

        if($file["quality"]=="sd" AND $file["width"]=="960"){

                      $link = $file["link"];

           }

}

As always we have GitHub source code link ready to grab it easily. We hope you discover this blog helpful and you’ve got any queries or feedback be at liberty to feature comment below this content.

laravel-vimeo-video-api-permanent-link

Free SEO Checker |
Test your website for free with OnAirSEO.com

Get Your SEO report!

Don’t miss the next post!

Loading

Related Posts