I'm creating a portfolio page where the user uploads images or informs a video URL from Youtube or Vimeo.
When the user informs a Vimeo URL i do the following steps:
1- Get the XML file from "vimeo.com/api/oembed.xml?url=[encoded_url]"
2- Get the "video_id" property from the file, with the video id (i can open the video in the browser with "vimeo.com/[video_id]", for instance)
3- Generate the embed video URL from the video id, just doing "player.vimeo.com/video/[video_id]"
4- Get the XML file from "vimeo.com/api/v2/video/[video_id].xml"
5- Get the "thumbnail_medium" property from the file, with the video thumbnail
WORKS FINE:
When i try, for instance, with the video "vimeo.com/channels/staffpicks/130537730" i do:
1- Get the XML file from "vimeo.com/api/oembed.xml?url=https%3A%2F%2Fvimeo.com%2Fchannels%2Fstaffpicks%2F130537730" - OK
2- Get the "video_id" property from the file - OK - Returns "130537730" (the video "vimeo.com/130537730" works fine)
3- Generate the embed video URL from the video id: "player.vimeo.com/video/130537730" - OK - Works fine
4- Get the XML file from "vimeo.com/api/v2/video/130537730.xml" - OK
5- Get the "thumbnail_medium" property from the file - OK - Returns "i.vimeocdn.com/video/536785976_200x150.jpg"
ERROR (THE FILE DOESN'T EXIST):
If i try it with the video with the URL "vimeo.com/ondemand/bendingsteel" (it's a trailer) i do:
1- Get the XML file from "vimeo.com/api/oembed.xml?url=https%3A%2F%2Fvimeo.com%2Fondemand%2Fbendingsteel" - OK
2- Get the "video_id" property from the file - OK - Returns "134429740" (the video "vimeo.com/134429740" works fine)
3- Generate the embed video URL from the video id: "player.vimeo.com/video/134429740" - OK - Works fine
4- Get the XML file from "vimeo.com/api/v2/video/134429740.xml" - ERROR - I don't get the file
Workaround (I don't think it's a good alternative):
The XML file from "vimeo.com/api/oembed.xml?url=https%3A%2F%2Fvimeo.com%2Fondemand%2Fbendingsteel" have a "thumbnail_url" property that returns a video thumbnail, and i got "i.vimeocdn.com/video/527925293_1280.jpg", but I wanted a smaller image for thumbnail.
Based on the thumbnail of the first video I manually changed the thumbnail of the second video to "i.vimeocdn.com/video/527925293_200x150.jpg" and it worked fine, but I don't think that this is a good approach and I don't know if this will work in all cases.
I don't know if i did something wrong, or if there's a better approach, or if this occurs because the video is a trailer, but i think this is a weird behaviour because everything else works fine.
I also tried with the video "vimeo.com/36031564" (it's not a trailer) and it worked fine, but with the video "vimeo.com/ondemand/ashestoagassiz" (it's a trailer) the same error occured, so i think this error will happen with trailers.
I tried with other types than XML but i still didn't get the file.
Any suggestion?
The URL that doesn't work (vimeo.com/api/v2/video/134429740.xml
) is part of the deprecated Simple API. This system never supported Vimeo On Demand, and no new development is happening on that API.
Your best bet is to use the new API.