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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesQueryDeviceVodUrl

The operation that you want to perform. Set the value to QueryDeviceVodUrl.

FileNameStringYesfile1

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.
SchemeStringNortmp

The protocol that is used by the video file. Valid values:

  • rtmp: Real Time Messaging Protocol (RTMP).
  • flv: HTTP Flash Video (HTTP-FLV) protocol.
  • hls: HTTP Live Streaming (HLS) protocol.
    Note For information about the limits on the use of HLS, see Cloud development.
SeekTimeIntegerNo0

The offset from the start time of the video file. Unit: seconds. Default value: 0.

IotInstanceIdStringNoiot-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
  • If the instance has an ID, you must specify this parameter. If you do not specify this parameter, the request fails.
  • If the Overview page is not displayed or the instance does not have an ID, you do not need to specify this parameter.

For more information, see the Overview topic of IoT instances.

ProductKeyStringNoa1BwAGV****

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.
DeviceNameStringNocamera1

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.
EnableStunBooleanNofalse

Specifies whether to enable peer-to-peer (P2P) video streaming.

  • true: enables P2P video streaming.
  • false (default): disables 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.
ShouldEncryptBooleanNofalse

Specifies whether to encrypt the video file.

  • true: encrypts the video file.
  • false (default): does not encrypt the video file.
IotIdStringNozLZyi6aOLyOSHa9hsPyD00****

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.
UrlValidDurationIntegerNo60

The validity period of the URL. Unit: seconds. Valid values: 10 to 14400. Default value: 10.

PlayUnLimitedBooleanNofalse

Specifies whether the URL can be used for an unlimited number of times.

  • true: The URL can be used for an unlimited number of times within 10 seconds.
  • false (default): The URL can be used only once.
EncryptTypeIntegerNo0

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

ParameterTypeExampleDescription
CodeString200

The response code. Valid values:

  • 200: The request was successful.
  • Other codes: The request failed. For more information about error codes, see Error codes.
DataStruct

The query result.

DecryptKeyString{\"iv\":\"MDEy**********+Pw==\",\"key\":\"TuqB5bpZ+589v********==\"}

The decryption key.

If you set the ShouldEncrypt parameter to true, the decryption key is generated.

StunInfoString{\"stunUrl\":\"101.***.***.**:3478?key=MuJtPMYxxxxxA&productKey=g2zbxxxxxx&udpRequestTimeout=300&udpRequestRetryNum=5&p2pSessionTimeout=10000&maxPortDetectNum=20&packetsPerSecond=1\"}

The address for the P2P live streaming.

VodUrlStringrtmp://***/***.mp4

The URL of the video file.

ErrorMessageStringproduct is not active.

The error message returned if the request failed.

RequestIdString06DC77A0-4622-42DB-9EE0-25FIOHS82JK1

The ID of the request.

SuccessBooleantrue

Indicates whether the request was successful.

  • true
  • false

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&amp;productKey=g2zbxxxxxx&amp;udpRequestTimeout=300&amp;udpRequestRetryNum=5&amp;p2pSessionTimeout=10000&amp;maxPortDetectNum=20&amp;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&amp;productKey=g2zbxxxxxx&amp;udpRequestTimeout=300&amp;udpRequestRetryNum=5&amp;p2pSessionTimeout=10000&amp;maxPortDetectNum=20&amp;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.