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

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
ActionStringYesQueryDeviceVodUrlByTime

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

BeginTimeIntegerYes1508200012

The beginning of the time range to query. The value is a 10-digit timestamp in seconds.

EndTimeIntegerYes1582420940

The end of the time range to query. The value is a 10-digit timestamp in seconds.

SchemeStringNortmp

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

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

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

IotInstanceIdStringNoiot-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
  • 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 of 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 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.
EnableStunBooleanNofalse

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

  • true
  • false (default)
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.
IotIdStringNoC47T6xwp6ms4bNlkHRWCg4****

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

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

PlayUnLimitedBooleanNofalse

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

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

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

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 returned information.

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 video streaming.

VodUrlStringhttps://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.

ErrorMessageStringtenant auth error

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. Valid values:

  • true
  • false

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&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>https://iotx-vision-vod-vpc-hz-pre.aliyun-inc.com/vod/device/localrecord/flv/play/1****668.flv?token=e9****a9e14482c56be52&amp;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&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": "https://iotx-vision-vod-vpc-hz-pre.aliyun-inc.com/vod/device/localrecord/flv/play/1****668.flv?token=e9****a9e14482c56be52&amp;session=470e****3d015"
    },
    "Code": 200,
    "Success": true
}

Error codes

For a list of error codes, see Service error codes.