新增hls root path参数
This commit is contained in:
55
test_cam.py
55
test_cam.py
@@ -13,30 +13,41 @@ signer = HikvisionOpenAPISigner(
|
||||
headers={'tagId': '0'} # 根据平台要求设置
|
||||
)
|
||||
|
||||
def get_camera_preview_url(camera_index_code):
|
||||
# 签名一个请求
|
||||
request = signer.sign(
|
||||
'POST',
|
||||
'/api/video/v1/cameras/previewURLs',
|
||||
jsons={'cameraIndexCode': camera_index_code, 'protocol': 'rtsp', 'expand': 'streamform=rtp'},
|
||||
accept='application/json'
|
||||
)
|
||||
method, url, headers, body = request
|
||||
# 发送请求
|
||||
response = requests.request(method, url, headers=headers, data=body, verify=False)
|
||||
return response.json()
|
||||
|
||||
# # for test
|
||||
# def get_camera_preview_url(camera_index_code):
|
||||
# """测试用的方法,直接返回固定结果"""
|
||||
# return {
|
||||
# "code": "0",
|
||||
# "msg": "SUCCESS",
|
||||
# "data": {
|
||||
# "url": "rtsp://localhost:8554/test"
|
||||
# }
|
||||
# }
|
||||
# # 签名一个请求
|
||||
# request = signer.sign(
|
||||
# 'POST',
|
||||
# '/api/video/v1/cameras/previewURLs',
|
||||
# jsons={'cameraIndexCode': camera_index_code, 'protocol': 'rtsp', 'expand': 'streamform=rtp'},
|
||||
# accept='application/json'
|
||||
# )
|
||||
# method, url, headers, body = request
|
||||
# # 发送请求
|
||||
# response = requests.request(method, url, headers=headers, data=body, verify=False)
|
||||
# return response.json()
|
||||
|
||||
# for test
|
||||
def get_camera_preview_url(camera_index_code):
|
||||
"""测试用的方法,直接返回固定结果"""
|
||||
return {
|
||||
"code": "0",
|
||||
"msg": "SUCCESS",
|
||||
"data": {
|
||||
# "url": "rtsp://192.168.110.139:8554/test"
|
||||
"url": "rtsp://192.168.43.33:8554/test"
|
||||
# "url": "rtsp://localhost:8554/test"
|
||||
}
|
||||
}
|
||||
|
||||
def get_camera_hls_url(camera_index_code):
|
||||
"""测试用的方法,直接返回固定结果"""
|
||||
return {
|
||||
"code": "0",
|
||||
"msg": "SUCCESS",
|
||||
"data": {
|
||||
"url": "https://demo.unified-streaming.com/k8s/live/scte35.isml/.m3u8"
|
||||
}
|
||||
}
|
||||
|
||||
# # 读取 config.yaml
|
||||
# with open('config.yaml', 'r', encoding='utf-8') as f:
|
||||
|
||||
Reference in New Issue
Block a user