-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhandle.php
More file actions
104 lines (85 loc) · 3.42 KB
/
Copy pathhandle.php
File metadata and controls
104 lines (85 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<?php
/**
* Email: john1688@qq.com
* User: john
* Date: 2017/10/18
* Time: 15:35
*/
require 'SDK.php';
class handle extends SDK {
/**
* 开启关闭推流
* @param $stream_id
* @param int $status 0表示禁用; 1表示允许推流;2表示断流
* @link https://cloud.tencent.com/document/api/267/5959
*/
public function Live_Channel_SetStatus($stream_id, $status)
{
$sign = $this->getSign();
if (!in_array($status, array(
0,1,2
))) {
$status = 0;
}
$this->url = "http://fcgi.video.qcloud.com/common_access?appid={$this->APPID}&interface=Live_Channel_SetStatus&t={$this->time}&sign={$sign}&Param.s.channel_id={$stream_id}&Param.n.status={$status}";
if ($stream_id) {
$this->url = $this->url."&Param.s.stream_id=$stream_id";
}
$this->request();
}
/**
* 云端混流 暂时用不到需要的看文档
* @link https://cloud.tencent.com/document/api/267/8832
*/
public function Mix_StreamV2()
{
$sign = $this->getSign();
$this->url = "http://fcgi.video.qcloud.com/common_access?appid={$this->APPID}&interface=Live_Channel_SetStatus&t={$this->time}&sign={$sign}";
}
/**
* 创建录制任务
* @param $stream_id
* @param $start_time
* @param $end_time
* @param int $task_sub_type
* @param string $file_format
* @param string $record_type
* @link https://cloud.tencent.com/document/api/267/9567
*/
public function Live_Tape_Start($stream_id, $start_time, $end_time, $task_sub_type = 0, $file_format = 'flv', $record_type = 'video')
{
$start_time = urlencode($start_time);
$end_time = urlencode($end_time);
$sign = $this->getSign();
$this->url = "http://fcgi.video.qcloud.com/common_access?appid={$this->APPID}&interface=Live_Tape_Start&t={$this->time}&sign={$sign}&Param.s.channel_id={$stream_id}&Param.s.start_time={$start_time}&Param.s.end_time={$end_time}&Param.n.task_sub_type={$task_sub_type}&Param.s.file_format={$file_format}&Param.s.record_type={$record_type}";
$this->request();
}
/**
* 暂停并延迟恢复
* @param $stream_id
* @param $abstime_end
* @param $action
* @link https://cloud.tencent.com/document/api/267/9500
*/
public function channel_manager($stream_id, $abstime_end, $action)
{
$action = $action == 'forbid' ? 'forbid' : 'resume';
$sign = $this->getSign();
$this->url = "http://fcgi.video.qcloud.com/common_access?appid={$this->APPID}&interface=Live_Channel_SetStatus&t={$this->time}&sign={$sign}&Param.s.channel_id={$stream_id}&Param.n.abstime_end={$abstime_end}&Param.s.action={$action}";
$this->request();
}
/**
* 结束录制任务
* @param $stream_id
* @param $task_id
* @param int $task_sub_type
* @link https://cloud.tencent.com/document/api/267/9568
*/
public function Live_Tape_Stop($stream_id, $task_id, $task_sub_type = 0)
{
$task_sub_type = $task_sub_type == 0 ? 0 : 1;
$sign = $this->getSign();
$this->url = "http://fcgi.video.qcloud.com/common_access?appid={$this->APPID}&interface=Live_Tape_Stop&t={$this->time}&sign={$sign}&Param.s.channel_id={$stream_id}&Param.s.task_id={$task_id}&Param.n.task_sub_type={$task_sub_type}";
$this->request();
}
}