Queries the URL of a video file based on the name of the file in the storage card of an on-premises network video recorder (NVR) or IP camera.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | QueryDeviceVodUrl | The operation that you want to perform. Set the value to QueryDeviceVodUrl. |
FileName | String | Yes | file1 | The name of the video file. You can call the InvokeThingService operation of IoT Platform to query the name of the video file. For information about the sample request of the InvokeThingService operation, see Additional description of request parameters. Note The name of the video file cannot exceed 180 characters in length. |
Scheme | String | No | rtmp | The protocol that is used by the video file. Valid values:
|
SeekTime | Integer | No | 0 | The offset from the start time of the video file. Unit: seconds. Default value: 0. |
IotInstanceId | String | No | iot-cn-n6w1y59**** | The ID of the IoT instance. You can obtain 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 in 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 view the DeviceName of the IP camera on the Devices page in 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.
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 | zLZyi6aOLyOSHa9hsPyD00**** | The ID of the IP camera. IoT Platform allocates a unique ID to each IP camera to identify the IP camera. You can call the QueryDeviceDetail operation of IoT Platform to query 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. Unit: seconds. Valid values: 10 to 14400. Default value: 10. |
PlayUnLimited | Boolean | No | false | Specifies whether the URL can be used for an unlimited number of times.
|
EncryptType | Integer | No | 0 | The encryption type of the video file. Only I-frame encryption is supported. Set the value to 0. |
Additional description of request parameters
The following sample request shows the request parameters of the InvokeThingService operation. For more information, see On-premises video playback.
https://iot.cn-shanghai.aliyuncs.com/?Action=InvokeThingService
&ProductKey=a1BwAGV****
&DeviceName=device1
&Identifier=QueryRecordList // The identifier of the service.
&Args={ // The input parameters of the service that you want to invoke. The value must be a JSON string.
"BeginTime":10, // The beginning of the time range to query. Unit: seconds. Valid values: 0 to 2147483647.
"Type":0, // The type of the video. 0: video that is captured based on a recording plan. 1: video that is captured in alert event-triggered recording. 2: video that is captured in manually triggered recording. 99: all recording types.
"QuerySize":2, // The number of records to query. Valid values: 0 to 128.
"EndTime":1541662222 // The end of the time range to query. Unit: seconds. Valid values: 0 to 2147483647.
}
&<Common request parameters>
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | 200 | The response code. Valid values:
|
Data | Struct | The query result. | |
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 live streaming. |
VodUrl | String | rtmp://***/***.mp4 | The URL of the video file. |
ErrorMessage | String | product is not active. | 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.
|
Examples
Sample requests
http(s)://linkvisual.cn-shanghai.aliyuncs.com/?Action=QueryDeviceVodUrl
&FileName=file1
&IotId=zLZyi6aOLyOSHa9hsPyD00****
&IotInstanceId=iot-cn-n6w1y59****
&<Common request parameters>
Sample success responses
XML
format
<QueryDeviceVodUrlResponse>
<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>rtmp://***/***.mp4</VodUrl>
</Data>
<Code>200</Code>
<Success>true</Success>
</QueryDeviceVodUrlResponse>
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": "rtmp://***/***.mp4"
},
"Code": 200,
"Success": true
}
Error codes
For a list of error codes, see Service error codes.