francis94c/vimeo-livestream

PHP Client Library for Vimeo Live Stream

dev-master 2020-09-23 10:36 UTC

This package is auto-updated.

Last update: 2024-04-23 18:42:35 UTC


README

build Coverage Status Maintainability Scrutinizer Code Quality

vimeo-livestream

PHP Client Library for Vimeo Live Stream.

68747470733a2f2f6c69766573747265616d2e636f6d2f6173736574732f696d616765732f7368617265642f6c69766573747265616d5f6f675f696d6167652e6a7067

Current Features Include

  • Create New Event.
  • Update an Event.
  • Get Associated Accounts.
  • Get Specific Accounts.
  • Update Event Poster.
  • Delete Event.

Installation

This Live Stream API is available on Packagist as francis94c/vimeo-livestream

$ composer require francis94c/vimeo-livestream:dev-master

Usage

Creating a LiveStream Instance.

use LiveStream\LiveStream;

$livestream = new LiveStream('[YOUR_API_KEY]');

Before you proceed, note that $livestream function calls that return null, indicates that the requested resource was not found. In summary, a 404 HTTP Response Code was received as a result of the call.

Every other HTTP Response Code except 200 & 201 will throw an Exception.

Get Accounts

Get all LiveStream accounts linked to the current API key.

$accounts = $livestream->getAccounts(); // Returns an array of account resources.

Get Specific Account

Get a specific LiveStream Account.

$account = $livestream->getAccount(23456 /*Account ID*/); // Returns \LiveStream\Resources\Account.

Create an Event

use LiveStream\Resources\Event;

$event = new Event("A Career Master Class" /*fullName*/);
// See https://livestream.com/developers/docs/api/#event-object
$event->setShortName("Master Class"); /*Or*/ $event->shortName = 'Master Class';
$event->setStartTime("2020-07-20 23:56:20"); /*Or*/ $event->startTime = /*Time in ISO8601 date time format*/

Update an Event

use LiveStream\Resources\Event;

$event = new Event("Physics Live Class on Motions.");

$event->setDescription("Motion")
    ->setStartTime(date('Y-m-d H:i:s'))
    ->setEndTime(date('Y-m-d H:i:s'))
    ->setShortName("Physics Short Name")
    ->setIsDraft(false)
    ->addTag('a')
    ->addTag('a')
    ->setId(3456343);

$livestream = new LiveStream('abc');

$livestream->updateEvent(5637245, $event);

Get RTMP Key

$key = $livestream->getRtmpKey(3456 /*Account ID*/, 4567, /*Event ID*/); // Returns \LiveStream\Resources\RTMPKey.
echo $key->id . ' --- ' . $key->rtmpUrl;
// OR
echo $key->getId() . ' --- ' . $key->getRtmpUrl();

Reset RTMP Key

$key = $livestream->resetRtmpKey(3456 /*Account ID*/, 4567, /*Event ID*/);