PHP code example of caiyun / vod

1. Go to this page and download the library: Download caiyun/vod 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/ */

    

caiyun / vod example snippets


use Caiyun\Vod\Facades\Vod;
use Caiyun\Vod\Contracts\VodDriver;

// 默认驱动
$credential = Vod::createUploadCredential('lesson.mp4', '课时视频', 1024000);
$play = Vod::getPlayCredential($mediaId);

// 指定驱动(历史媒资按 provider 回放)
$play = Vod::driver('tencent')->getPlayCredential($mediaId);

// 依赖注入
public function credential(VodDriver $vod)
{
    return $vod->createUploadCredential(...);
}
bash
php artisan vendor:publish --tag=vod-config