文档:https://cloud.tencent.com/document/api/267/45981
NOTICE:
1. 录制任务开启后,录制的结果在点播平台
2. 出现:
则更换流名称即可。若同一条流当前存在多个时段重叠的任务,为避免重复录制系统将启动最多3个录制任务。
3. 具体流程如下:
1. 安装Composer:
windows环境请访问[Composer官网](https://getcomposer.org/download/)下载安装包安装。
【注意】dos下 输入:composer查看是否已经安装成功。第一次安装以后,需要重启。
2. 建议中国大陆地区的用户设置腾讯云镜像源:`composer config -g repos.packagist composer https://mirrors.tencent.com/composer/`
3. 执行命令 `composer require tencentcloud/tencentcloud-sdk-php` 添加依赖。
4. 在代码中添加以下引用代码。注意:如下仅为示例,composer 会在项目根目录下生成 vendor 目录,`/path/to/`为项目根目录的实际绝对路径,如果是在当前目录执行,可以省略绝对路径。
require '/path/to/vendor/autoload.php';
具体代码参考:
require_once 'vendor/autoload.php';
use TencentCloud\Common\Credential;
use TencentCloud\Common\Profile\ClientProfile;
use TencentCloud\Common\Profile\HttpProfile;
use TencentCloud\Common\Exception\TencentCloudSDKException;
use TencentCloud\Live\V20180801\LiveClient;
use TencentCloud\Live\V20180801\Models\CreateRecordTaskRequest;
use TencentCloud\Live\V20180801\Models\StopRecordTaskRequest;
$cred = new Credential("参数key", "参数secret");
$httpProfile = new HttpProfile();
$httpProfile->setEndpoint("live.tencentcloudapi.com");
$clientProfile = new ClientProfile();
$clientProfile->setHttpProfile($httpProfile);
$client = new LiveClient($cred, "ap-guangzhou", $clientProfile);
$req = new CreateRecordTaskRequest();
$params = array(
"StreamName" => $streamName,
"DomainName" => '参数域名',
"AppName" => $appName,
"EndTime" => time()+3600*12
);
$req->fromJsonString(json_encode($params));
$resp = $client->CreateRecordTask($req);
return json_decode($resp->toJsonString(),true);