PHP code example of coconing / transcoding

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

    

coconing / transcoding example snippets




$config = [
    'access_key' => '七牛云AK',
    'secret_key' => ‘七牛云SK',
    'bucket' => '空间名',
    'pipeline' => '转码是使用的队列名称。 https://portal.qiniu.com/mps/pipeline,你也可以为空,使用默认的转码队列',
    'notifyUrl' => '转码完成后异步通知到你的业务服务器',
    'fops' => "要进行转码的转码操作。 http://developer.qiniu.com/docs/v6/api/reference/fop/av/avthumb.html"
];

$transcoding = new \CocoNing\Transcoding\Prepare($config);

list($id, $err) = $transcoding->videoTranscoding('cocoyo.qlv');

if ($err !== null) {
    var_dump($err);
} else {
    var_dump($id);
}

$transcoding = new \CocoNing\Transcoding\Prepare();
$transcoding->setConfig($config);
list($id, $err) = $transcoding->videoTranscoding('cocoyo.qlv');