Queries the playback URL of a video file within a time range in the storage card of an on-premises network video recorder (NVR) or IP camera.
Limits
This operation is applicable only to scenarios in which IP cameras are directly connected to IoT Platform.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QueryDeviceVodUrlByTime | The operation that you want to perform. Set the value to QueryDeviceVodUrlByTime. |
BeginTime | Integer | Yes | 1508200012 | The beginning of the time range to query. The value is a 10-digit timestamp in seconds. |
EndTime | Integer | Yes | 1582420940 | The end of the time range to query. The value is a 10-digit timestamp in seconds. |
Scheme | String | No | rtmp | The protocol that is used by the video file. Valid values:
|
SeekTime | Integer | No | 0 | The offset from the beginning time of the video file. Unit: seconds. Default value: 0. |
IotInstanceId | String | No | iot-cn-n6w1y**** | The ID of the IoT instance. You can view the ID of the instance on the Overview page in the IoT Platform console. Important
For more information, see the Overview topic of IoT instances. |
ProductKey | String | No | a1BwAGV**** | The ProductKey of the product to which the IP camera belongs. You can view information about all products within the current Alibaba Cloud account on the Products page of the IoT Platform console or by calling the QueryProductList operation. Important If you specify this parameter, you must also specify the DeviceName parameter. |
DeviceName | String | No | camera1 | The DeviceName of the IP camera. You can obtain the DeviceName of the IP camera on the Devices page of the IoT Platform console. Important If you specify this parameter, you must also specify the ProductKey parameter. |
EnableStun | Boolean | No | false | Specifies whether to enable peer-to-peer (P2P) video streaming. Valid values:
Note This feature is available only to users in the whitelist. For more information, email Alibaba Cloud at cangyu.fhb@alibaba-inc.com . |
ShouldEncrypt | Boolean | No | false | Specifies whether to encrypt the video file.
|
IotId | String | No | C47T6xwp6ms4bNlkHRWCg4**** | The ID of the IP camera. The ID is a unique identifier issued by IoT Platform to the IP camera. You can call the QueryDeviceDetail operation of IoT Platform to query the details of devices and obtain the ID of the IP camera. Important If you specify this parameter, you do not need to specify the ProductKey and DeviceName parameters. The IotId parameter specifies a GUID for the IP camera. The value of the IotId parameter is equivalent to the combination of the values of the ProductKey and DeviceName parameters. If you specify the IotId, ProductKey, and DeviceName parameters, the value of the IotId parameter takes precedence. |
UrlValidDuration | Integer | No | 60 | The validity period of the URL. Valid values: 10 to 14400. Unit: seconds. Default value: 10. |
PlayUnLimited | Boolean | No | false | Specifies whether the URL can be used for an unlimited number of times. Valid values:
|
EncryptType | Integer | No | 0 | The encryption type of the video file. Only I-frame encryption is supported. Set the value to 0. |
In addition to the preceding operation-specific request parameters, you must specify common request parameters when you call this operation. For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 | The response code. Valid values:
|
Data | Struct | The returned information. | |
DecryptKey | String | {\"iv\":\"MDEy**********+Pw==\",\"key\":\"TuqB5bpZ+589v********==\"} | The decryption key. If you set the ShouldEncrypt parameter to true, the decryption key is generated. |
StunInfo | String | {\"stunUrl\":\"101.***.***.**:3478?key=MuJtPMYxxxxxA&productKey=g2zbxxxxxx&udpRequestTimeout=300&udpRequestRetryNum=5&p2pSessionTimeout=10000&maxPortDetectNum=20&packetsPerSecond=1\"} | The address for the P2P video streaming. |
VodUrl | String | https://iotx-vision-vod-vpc-hz-pre.aliyun-inc.com/vod/device/localrecord/flv/play/1****668.flv?token=e9****a9e14482c56be52&session=470e****3d015 | The URL of the video file. |
ErrorMessage | String | tenant auth error | The error message returned if the request failed. |
RequestId | String | 06DC77A0-4622-42DB-9EE0-25FIOHS82JK1 | The ID of the request. |
Success | Boolean | true | Indicates whether the request was successful. Valid values:
|
Examples
Sample requests
http(s)://linkvisual.cn-shanghai.aliyuncs.com/?Action=QueryDeviceVodUrlByTime
&BeginTime=1508200012
&EndTime=1582420940
&IotId=C47T6xwp6ms4bNlkHRWCg4****
&IotInstanceId=iot-cn-n6w1y****
&<Common request parameters>
Sample success responses
XML
format
<QueryDeviceVodUrlByTimeResponse>
<RequestId>06DC77A0-4622-42DB-9EE0-25FIOHS82JK1</RequestId>
<Data>
<StunInfo>{\"stunUrl\":\"101.***.***.**:3478?key=MuJtPMYxxxxxA&productKey=g2zbxxxxxx&udpRequestTimeout=300&udpRequestRetryNum=5&p2pSessionTimeout=10000&maxPortDetectNum=20&packetsPerSecond=1\"}</StunInfo>
<DecryptKey>{\"iv\":\"MDEy**********+Pw==\",\"key\":\"TuqB5bpZ+589v********==\"}</DecryptKey>
<VodUrl>https://iotx-vision-vod-vpc-hz-pre.aliyun-inc.com/vod/device/localrecord/flv/play/1****668.flv?token=e9****a9e14482c56be52&session=470e****3d015</VodUrl>
</Data>
<Code>200</Code>
<Success>true</Success>
</QueryDeviceVodUrlByTimeResponse>
JSON
format
{
"RequestId": "06DC77A0-4622-42DB-9EE0-25FIOHS82JK1",
"Data": {
"StunInfo": "{\\\"stunUrl\\\":\\\"101.***.***.**:3478?key=MuJtPMYxxxxxA&productKey=g2zbxxxxxx&udpRequestTimeout=300&udpRequestRetryNum=5&p2pSessionTimeout=10000&maxPortDetectNum=20&packetsPerSecond=1\\\"}",
"DecryptKey": "{\"iv\":\"MDEy**********+Pw==\",\"key\":\"TuqB5bpZ+589v********==\"}",
"VodUrl": "https://iotx-vision-vod-vpc-hz-pre.aliyun-inc.com/vod/device/localrecord/flv/play/1****668.flv?token=e9****a9e14482c56be52&session=470e****3d015"
},
"Code": 200,
"Success": true
}
Error codes
For a list of error codes, see Service error codes.