Coder Social home page Coder Social logo

gumlet-api's Introduction

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();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.