Skip to content

ivanzhang2/vod-php-sdk-v5

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

简介

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

使用方式

Composer

  • 引入依赖
{
    "require": {
        "qcloud/vod-sdk-v5": "v2.4.0"
    }
}
  • 调用示例
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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%