PHP code example of serch3 / bunny-stream

1. Go to this page and download the library: Download serch3/bunny-stream library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

serch3 / bunny-stream example snippets


$client = new \Bunny\Stream\Client('API_KEY', 'LIBRARY_ID');

$client->listVideos();

$client->listVideos($search, $page, $items, $collection, $orderby); //filtered results

$client->getVideo($videoId);

$body = [
        'title' => '...',
        'collectionId' => '...',
        'chapters' => [
            [
                'title' => 'Chapter 1',
                'start' => 0,
                'end' => 300,
            ]
        ],
        'moments' => [
            [
                'label' => 'Awesome Scene 1',
                'timestamp' => 70,
            ],
        ],
        'metaTags' => [
            [
                'property' => 'description',
                'value' => 'My Video Description',
            ],
        ],
];
$client->updateVideo($videoId, $body);

$client->deleteVideo($videoId);

$client->createVideo($title, $collectionId, $thumbnailTime);

$client->uploadVideoWithVideoId($videoId, $path, $enabledResolutions);

$client->uploadVideo($title, $path, $collectionId, $thumbnailTime, $enabledResolutions);

$client->setVideoThumbnail($videoId, $url);

$client->getVideoHeatmap($videoId);

$client->getVideoPlayData($videoId, $token, $expires);

$query = [
    'dateFrom' => 'm-d-Y',
    'dateTo' => 'm-d-Y',
    'hourly' => false,
    'videoGuid' => '...',
];
$client->getVideoStatistics($videoId, $query);

$client->reencodeVideo($videoId);

$client->addOutputCodec($videoId, $codec);

$client->repackageVideo($videoId, $keepOriginalFiles);

$client->fetchVideo($url, $title, $collectionId, $thumbnailTime, $headers);

$client->addCaption($videoId, $srclang, $path, $label);

$client->deleteCaption($videoId, $srclang);

$client->transcribeVideo($videoId, $language, $force);

$client->requestVideoResolutionsInfo($videoId);

$config = [
    'deleteNonConfiguredResolutions' => true,
    'deleteOriginal' => false,
    'deleteMp4Files' => true,
    'dryRun' => false,
];
$resolutions = "240p,360p,480p";

$client->cleanupResolutions($videoId, $resolutions, $query);

$client->listCollections($search, $page, $items, $orderby, $

$client->getCollection($collectionId, $

$client->createCollection($name);

$client->updateCollection($collectionId, $name);

$client->deleteCollection($collectionId);