haxibiao/vod-php-sdk

This package is abandoned and no longer maintained. The author suggests using the haxibiao/vod-sdk package instead.

VOD SDK For PHP

2.4.3 2021-01-21 07:38 UTC

This package is auto-updated.

Last update: 2021-01-21 07:39:14 UTC


README

基于PHP语言平台的服务端上传的SDK,通过SDK和配合的Demo,可以将视频和封面文件直接上传到腾讯云点播系统,同时可以指定各项服务端上传的可选参数。

使用方式

Composer

  • 引入依赖
{
    "require": {
        "haxibiao/vod-sdk": "*"
    }
}
  • 调用示例
require 'vendor/autoload.php';

use Vod\VodUploadClient;
use Vod\Model\VodUploadRequest;

$client = new VodUploadClient("your secretId", "your secretKey");
$req = new VodUploadRequest();
$req->MediaFilePath = "the path to media file";
$req->CoverFilePath = "the path to cover file";
try {
    $rsp = $client->upload("ap-guangzhou", $req);
    echo "FileId => ". $rsp->FileId . "\n";
    echo "MediaUrl -> ". $rsp->MediaUrl . "\n";
    echo "CoverUrl -> ". $rsp->CoverUrl . "\n";
} catch (Exception $e) {
    // 处理上传异常
    echo $e;
}

上传成功后将获取文件的播放地址和 FileId

通过源码包安装

require 'vod-sdk-v5/autoload.php';

use Vod\VodUploadClient;
use Vod\Model\VodUploadRequest;

$client = new VodUploadClient("your secretId", "your secretKey");
$req = new VodUploadRequest();
$req->MediaFilePath = "the path to media file";
$req->CoverFilePath = "the path to cover file";
try {
    $rsp = $client->upload("ap-guangzhou", $req);
    echo "FileId => ". $rsp->FileId . "\n";
    echo "MediaUrl -> ". $rsp->MediaUrl . "\n";
    echo "CoverUrl -> ". $rsp->CoverUrl . "\n";
} catch (Exception $e) {
    // 处理上传异常
    echo $e;
}

上传成功后将获取文件的播放地址和 FileId