Wednesday, November 25, 2015

Liking, Watchlisting and Uploading through Vimeo’s API

In a previous post, we used the Vimeo API to build a rudimentary video application with Silex and Twig. We added login and user feed functionality and wrapped it all up with a video searching feature. In this one, we’ll add in liking a video, adding a video to a watchlist for later, and uploading videos via the Vimeo API.

Vimeo Logo

Prerequisites

To get up to speed, please skim through the code presented in the previous part and get it to run in your development environment (preferably Homestead Improved). Alternatively, just download the final code of the previous post here. Once you’re ready, continue with the content below.

Interacting with Videos

In this section, you’re going to add the capability to like and add videos to be watched later. But before that, you first need to update the scopes for the Vimeo login (in the previous post, we only asked for public and private scope permissions). Add interact as one of the items, and once that’s done, access the login page in the browser and try logging in again.

$scopes = array('public', 'private', 'interact');
$state = substr(str_shuffle(md5(time())), 0, 10);
$_SESSION['state'] = $state;

$url = $vimeo->buildAuthorizationEndpoint(REDIRECT_URI, $scopes, $state);

$page_data = array(
    'url' => $url
);

It should now show an additional item under permissions. Check that to allow video interactions.

Continue reading %Liking, Watchlisting and Uploading through Vimeo’s API%


by Wern Ancheta via SitePoint

No comments:

Post a Comment