mercredi 30 septembre 2015

Can't get file with thumbnail from Vimeo

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 "http://ift.tt/1WxL0FM]"

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 "http://player.vimeo.com/video/[video_id]"

4- Get the XML file from "http://ift.tt/1P5sliA"

5- Get the "thumbnail_medium" property from the file, with the video thumbnail


WORKS FINE:

When i try, for instance, with the video "http://ift.tt/1WxL0FQ" 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: "http://player.vimeo.com/video/130537730" - OK - Works fine

4- Get the XML file from "http://ift.tt/1WxL0FU" - OK

5- Get the "thumbnail_medium" property from the file - OK - Returns "http://ift.tt/1P5sjau"


ERROR (THE FILE DOESN'T EXIST):

If i try it with the video with the URL "http://ift.tt/1WxKYxD" (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: "http://player.vimeo.com/video/134429740" - OK - Works fine

4- Get the XML file from "http://ift.tt/1WxKYxF" - 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 "http://ift.tt/1WxKYxH", 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 "http://ift.tt/1WxKYxL" 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 "http://ift.tt/1P5sliC" (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?




Aucun commentaire:

Enregistrer un commentaire