Api.php
3.3 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
<?php
namespace isc;
use isc\Token;
use fast\Http;
class Api extends Token
{
/* 查询资源列表v2
* $name 设备名称
*/
public function resourcesByParams($name){
$url = '/api/irds/v2/resource/resourcesByParams';
$data['name'] = $name;
$data['resourceType'] = 'camera';
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/* 根据监控点编号获取萤石云设备
* $cameraIndexCode 设备编号
*/
public function ezvizSafeWatchKey($cameraIndexCode){
$url = '/api/video/v1/cameras/ezvizSafeWatchKey';
$data['cameraIndexCode'] = $cameraIndexCode;
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/* 获取监控流地址
* $cameraIndexCode 设备编号
* $protocol 取流协议 默认flv
* $streamType 0:主码流 1:子码流 2:第三码流
*/
public function getPreviewUrl($cameraIndexCode,$protocol='rtsp',$streamType=0){
$url = '/api/video/v2/cameras/previewURLs';
$data['cameraIndexCode'] = $cameraIndexCode;
$data['streamType'] = $streamType;
//$data['expand'] = "transcode=1&resolution=720P";
$data['protocol'] = $protocol;
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/* 获取监控流地址
* $cameraIndexCode 设备编号
* $protocol 取流协议 默认flv
* $streamType 0:主码流 1:子码流 2:第三码流
*/
public function playbackUrl($cameraIndexCode,$beginTime,$endTime){
$url = '/api/video/v2/cameras/playbackURLs';
$data['cameraIndexCode'] = $cameraIndexCode;
$data['beginTime'] = $beginTime;
$data['endTime'] = $endTime;
$data['recordLocation'] = "1";
$data['expand'] = "transcode=1&streamform=rtp";
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/* 查询对讲URL
* $cameraIndexCode 设备编号
*/
public function getTalkUrl($cameraIndexCode){
$url = '/api/video/v1/cameras/talkURLs';
$data['cameraIndexCode'] = $cameraIndexCode;
//$data['streamType'] = 0;
//$data['expand'] = "transcode=1&resolution=720P";
//$data['protocol'] = $protocol;
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/* 云台操作
* $cameraIndexCode 设备编号
* $action 0-开始 ,1-停止
* $command 转向
* $speed 云台速度,取值范围为1-100,默认50
* $presetIndex 预置点编号
*/
public function controlling($cameraIndexCode,$action,$command,$speed=50){
$url = '/api/video/v1/ptzs/controlling';
$data['cameraIndexCode'] = $cameraIndexCode;
$data['action'] = $action;
$data['command'] = $command;
$data['speed'] = $speed;
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
/**
* 手动抓图
*/
public function manualCapture($cameraIndexCode){
$url = '/api/video/v1/manualCapture';
$data['cameraIndexCode'] = $cameraIndexCode;
$res = $this->posturl($url,$data);
return json_decode($res,true);
}
}