Skip to content

Latest commit

 

History

History
150 lines (123 loc) · 8.36 KB

File metadata and controls

150 lines (123 loc) · 8.36 KB

Telestream Cloud Flip PHP SDK

This library provides a low-level interface to the REST API of Telestream Cloud, the online video encoding service.

Requirements

PHP 5.5 and later

Getting Started

Initialize client

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$config = TelestreamCloudFlip\Configuration::getDefaultConfiguration()->setApiKey('X-Api-Key', 'tcs_xxxxxxxxx');
$api = new TelestreamCloudFlip\Api\FlipApi(new GuzzleHttp\Client(), $config);
$factory = "factory_id";
?>

Create video from source url

<?php
$createVideoBody = new TelestreamCloudFlip\Model\CreateVideoBody();
$createVideoBody->setSourceUrl('http://url/to/video.mp4');

$video = $api->createVideo($factory, $createVideoBody);
print_r($video);
?>

Upload video to flip service

<?php
try {
    $upload = new TelestreamCloudFlip\Uploader($api, array(
        'factory_id' => $factory,
        'file' => '/tmp/video.mp4',
        'extra_files' => array(
            'subtitles' => array('path/to/subtitles.srt')
        ),
    ));

    $video_id = $upload->upload();
    echo $video_id;
} catch(Exception $e) {
    // Handle exception
}
?>

Documentation for API Endpoints

All URIs are relative to https://api.cloud.telestream.net/flip/3.1

Class Method HTTP request Description
FlipApi cancelEncoding POST /encodings/{id}/cancel.json Cancels an Encoding.
FlipApi copyProfile POST /profiles/{id}/copy.json Copies a given Profile
FlipApi createEncoding POST /encodings.json Creates an Encoding
FlipApi createFactory POST /factories.json Creates a new factory
FlipApi createProfile POST /profiles.json Creates a Profile
FlipApi createVideo POST /videos.json Creates a Video from a provided source_url.
FlipApi createWorkorder POST /workorders.json Creates a Workorder.
FlipApi deleteEncoding DELETE /encodings/{id}.json Deletes an Encoding from both Telestream Cloud and your storage. Returns an information whether the operation was successful.
FlipApi deleteProfile DELETE /profiles/{id}.json Deletes a given Profile
FlipApi deleteVideo DELETE /videos/{id}.json Deletes a Video object.
FlipApi deleteVideoSource DELETE /videos/{id}/source.json Delete a video's source file.
FlipApi encoding GET /encodings/{id}.json Returns an Encoding object.
FlipApi encodings GET /encodings.json Returns a list of Encoding objects
FlipApi encodingsCount GET /encodings/count.json Returns a number of Encoding objects created using a given factory.
FlipApi factories GET /factories.json Returns a collection of Factory objects.
FlipApi factory GET /factories/{id}.json Returns a Factory object.
FlipApi notifications GET /notifications.json Returns a Factory's notification settings.
FlipApi profile GET /profiles/{id_or_name}.json Returns a Profile object.
FlipApi profileEncodings GET /profiles/{id_or_name}/encodings.json Returns a list of Encodings that belong to a Profile.
FlipApi profiles GET /profiles.json Returns a collection of Profile objects.
FlipApi queuedVideos GET /videos/queued.json Returns a collection of Video objects queued for encoding.
FlipApi resubmitVideo POST /videos/resubmit.json Resubmits a video to encode.
FlipApi retryEncoding POST /encodings/{id}/retry.json Retries a failed encoding.
FlipApi signedEncodingUrl GET /encodings/{id}/signed-url.json Returns a signed url pointing to an Encoding.
FlipApi signedEncodingUrls GET /encodings/{id}/signed-urls.json Returns a list of signed urls pointing to an Encoding's outputs.
FlipApi signedVideoUrl GET /videos/{id}/signed-url.json Returns a signed url pointing to a Video.
FlipApi toggleFactorySync POST /factories/{id}/sync.json Toggles synchronisation settings.
FlipApi updateEncoding PUT /encodings/{id}.json Updates an Encoding
FlipApi updateFactory PATCH /factories/{id}.json Updates a Factory's settings. Returns a Factory object.
FlipApi updateNotifications PUT /notifications.json Updates a Factory's notification settings.
FlipApi updateProfile PUT /profiles/{id}.json Updates a given Profile
FlipApi uploadVideo POST /videos/upload.json Creates an upload session.
FlipApi video GET /videos/{id}.json Returns a Video object.
FlipApi videoEncodings GET /videos/{id}/encodings.json Returns a list of Encodings that belong to a Video.
FlipApi videoMetadata GET /videos/{id}/metadata.json Returns a Video's metadata
FlipApi videos GET /videos.json Returns a collection of Video objects.
FlipApi workflows GET /workflows.json Returns a collection of Workflows that belong to a Factory.

Documentation For Models

Documentation For Authorization

api_key

  • Type: API key
  • API key parameter name: X-Api-Key
  • Location: HTTP header

Author

[email protected]