Search code examples
phpvideovimeovimeo-api

Vimeo Php Api, how to play a private video programmatically and without login?


i'm trying to use, Vimeo php api to play a private video using his id. I have created an account pro on vimeo, i have created a Vimeo app, i have created a token with public and private scope. The php code i use is this:

require("../Vimeo PHP path/autoload.php");
use Vimeo\Vimeo;
$client_id = "*****"; //your Vimeo number here
$client_secret = "*****"; //your Vimeo number here
$access_token = "*****"; //your Vimeo number here

 $vimeo = new Vimeo($client_id, $client_secret, $access_token);
 $videos = $vimeo->request("/videos/$video_id");
 print_r($videos);

It works (i have take this code here). Launching the page i can see my video inside the print_r($videos), but is still private, i see the black screen "Private video, log in to watch". Why? If i pass a client_id, a token and a secret i can't see a private video? Only users that are signed in my site can see my vimeo videos, but i wanna embed this video without force my users to create a vimeo account. How i can achive this result with private videos?


Solution

  • The video that is visible in that print_r is the embed video. At this step, the site respects your embed settings, followed by your on site privacy settings.

    If you want to use the embed, you must set your video's privacy to "Hide from vimeo" (or disabled in the API), and then set your embed privacy to anything but "Nowhere"

    If you want to use your own player, or a mobile device, you want to use one of the urls in the files key of the JSON response.