Search code examples
vimeovimeo-apivimeo-player

Using the Vimeo API or other code, how can I tell when a video can be watched after uploading?


After uploading a video using the Vimeo API, it is not instantly available for viewing, as some processing needs to be done by Vimeo to get it into their format. In the meantime if you load the soon-to-be-valid video link into a browser within an iframe, there is a message, "Sorry This video will be available for viewing shortly." instead of the video player, as the video is not yet available to view.

I've looked at the Vimeo API reference and did not find anything that seemed related. I also understand that I cannot access the contents of an iframe using javascript code when the src resource is foreign to my domain.

Am I missing something? How can I do this?

Below is the iframe as it appears in my Angular app.:

 <iframe [src]="mySafeLink" width="640" height="480" frameborder="0" allow="autoplay; fullscreen"
    allowfullscreen></iframe>

Solution

  • The answer is this:

    GET https://api.vimeo.com/videos/[video_id]?fields=uri,upload.status,transcode.status

    The upload.status and transcode.status fields will return one of the following values:

    complete
    error
    in_progress

    To test it, create a request in Postman as follows: set the request type to GET and the URL as it appears above. Under Headers, add a Key named Authorization and set its Value to: bearer [your access token]

    The brackets "[" and "]" should be dropped and replaced with the contents indicated.

    Answer came from https://github.com/vimeo/vimeo.js/issues/89#issuecomment-437398447