Skip to content

cp6/gumlet-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gumlet video hosting and streaming API wrapper

Please note that this package is still in progress!

Badge Badge


Table of contents


Features

Create and update videos & profiles...


Installing and Usage

Install with composer:

composer require corbpie/gumlet-api

Use like:

require __DIR__ . '/vendor/autoload.php';

use Corbpie\Gumlet;

$gm = new Gumlet\GumletVideo();

Setting API key:

Line 7 GumletBase.php

const API_KEY = 'XXXX-XXXX-XXXX';

Video


List Profiles

 $gm->listProfiles();

Set Profile

Requires $gm->profile_id to be set

$gm->profile_id = 'TJQuvxBnOcxQwnPOWc';

Get Profile

Requires $gm->profile_id to be set

 $gm->getProfile();

Create a Profile

 $parameters = [
 'description' => 'The description for this new profile',
 'mp4_access' => true
];

 $format = 'HLS';//HLS, MPEG-DASH, MP4

 $gm->createProfile('the-new-profile-name', $format, $parameters);

List videos

Requires $gm->video_collection to be set

 $gm->listVideos();

Get video details

 $gm->video_id = '65f1819d759d13a91c0a4c09';

 echo json_encode($gm->getVideo());

Create video from a URL

Requires $url and $gm->video_collection

 $gm->createVideoFromUrl($url, $format, $parameters);

Inputs:

Note setting $gm->profile_id will override everything except the $url and the collection id

string $url The URL to download the video from to use.

string $format Format for the video encoding "HLS, MPEG-DASH and MP4" ONLY!

array $parameters Optional values for the video creation:

[
'tag'=> 'example, another',
'title'=> 'title to video',
'description'=> 'This video is all about XYZ',
'width'=> '75%',
'height'=> '75%',
'resolution'=> '720p',
'mp4_access'=> true,
'per_title_encoding'=> false,
'process_low_resolution_input'=> true,
'audio_only'=> false,
'enable_drm'=> true
]

Example for creating a video from URL with multiple audio tracks:

$parameters = [
    'profile_id' => '65138fa952ccfd817db2a665',
    'title' => 'The title for this great video',
    'description' => 'The description for this great video',
    'mp4_access' => false,
    'audio_only' => false,
    'additional_tracks' => [
        [
            'url' => 'https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac',
            'type' => 'audio',
            'language_code' => 'en',
            'name' => 'English'],
        [
            'url' => 'https://gumlet.sgp1.digitaloceanspaces.com/video/sample_1.aac',
            'type' => 'audio',
            'language_code' => 'pl',
            'name' => 'Polish'
        ]
    ]
];

$video = $gm->createVideoFromUrl(
    'https://domain.com/video.mp4',
    'MP4',
    $parameters
);

Update thumbnail from frame

 $gm->video_id = '65f1819d759d13a91c0a4c09';
 
 $frame = 20;
 $gm->updateVideoThumbnailFromFrame($frame);

Update video title

 $gm->video_id = '65f1819d759d13a91c0a4c09';
 
 $gm->updateVideoTitle('The new title for this video');

Update video description

 $gm->video_id = '65f1819d759d13a91c0a4c09';
 
 $gm->updateVideoDescription('The new description for this video');

Delete video

 $gm->video_id = '65f1819d759d13a91c0a4c09';
 
 $gm->deleteVideo();