vasanthkumar
vasanthkumar

Reputation: 144

Vimeo - How to check if a video exists and playable?

My client has a video uploaded in vimeo.com that does not play. When I access the url with https://vimeo.com/videoid, it gives the response "Video conversion failed".

How can I get this response ?

I have gone through the API in developer.vimeo.com and am not able to find one.

Tried the following ways to solved which did not help. 1. get_headers(vimeo.com/videoid); 2. http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/videoid

Upvotes: 0

Views: 2138

Answers (2)

Rodgath
Rodgath

Reputation: 575

You can use the HEAD request method using the video URL.

function check_remote_video_exists($video_url) {

    $headers = @get_headers($video_url);

    return (strpos($headers[0], '200') > 0) ? true : false;
}

Check your vimeo URL like so:

if (check_remote_video_exists('YOUR_VIMEO_VIDEO_URL')) {

    // video exists, do stuff

} else {

    // video does not exist, do other stuff

}

Hope this helps someone.

Upvotes: 0

Steeven Sylveus
Steeven Sylveus

Reputation: 161

when you call the api https://api.vimeo.com/videos/videoId, If you get a 200 Ok response, that response will contain a flag call status.

you can check to see if status is available or transcoding.

Upvotes: 3

Related Questions