Video Streaming

1.Get Live Streaming

Description

This API is used to get live streaming of the IPC.

Request link

https://192.168.0.1/openapi/media/getLiveStream, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

No private parameter for this API, please refer to Public Parameters for more details.

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 3, 5, 7, 232, see Error Code for further details.
hd_live_urlstringHigh-Definition live streaming of the IPC using RTSP.
fhd_live_urlstringFull High-Definition live streaming of the IPC using RTSP.

Request Example

POST /openapi/media/getLiveStreamHTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=1564565937&sign=IDKNFLK392038KDS932K

Response Example

{
   “code”:              0,
   “data”: {
      “hd_live_url”:  “rtsp://192.168.0.1/ed98eeead4c843f898fef1c203313364/live_hd.sdp”,
      “fhd_live_url”:  “rtsp://192.168.0.1/ed98eeead4c843f898fef1c203313364/live_fhd.sdp”
  }
}

2.Get Playback Streaming

Description

This API is used to get playback streaming of the IPC.

Request link

https://192.168.0.1/openapi/media/getPlaybackStream, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongStart time of the playback streaming, seconds in UNIX format.Y1578969264
end_timelongEnd time of the playback streaming, seconds in UNIX format.Y1579055640

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 3, 5, 7, 230, 235, see Error Code for further details.
playback_urlstringPlayback streaming of the IPC using RTSP.

Request Example

POST /openapi/media/getPlaybackStream HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=1564565937&sign=IDKNFLK392038KDS932K&start_time=1564565637&end_time=1564565697

Response Example

{
   “code”:              0,
   “data”: {
       “playback_url”:  “rtsp://192.168.0.1/ed98eeead4c843f898fef1c203313364/pb.sdp”
    }
}

3.Get Record List

Description

This API is used to get record list of the IPC.

Request link

https://192.168.0.1/openapi/media/getRecordList, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

Below are private parameters for this API, please refer to Public Parameters for more details.

ParameterTypeDescriptionRequiredExample
start_timelongStart time of record files, seconds in UNIX format.Y1578969264
end_timelongEnd time of record files, seconds in UNIX format.Y1579055640
page_numintCurrent page, default is 1, minimum is 1.N1
page_sizeintNumber of record files in one page, default is 10, range is [0, 500].N10

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 3, 5, 7, 231, 234, 235, see Error Code for further details.
total_numintTotal number of the eligible record files, about one minute per record file.
return_numintReturned number this time.
start_timelongStart time of the record file.
end_timelongEnd time of the record file.
urlstringDownload address of the record file.

Request Example

POST /openapi/media/getRecordList HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=1564565937&sign=IDKNFLK392038KDS932K&start_time=1564565216&end_time=1564565697&page_num=2&page_size=30

Response Example

{
   “code”:              0,
   “data”: {
    “total_num”: 100,
    “return_num”: 30,
    “record_list”:[{
    “start_time”: 1564565216,
    “end_time”: 1564565276,
    “url”:  “https://192.168.0.1/mnt/sd-card/sunmi_video/video_plan/20190731172656_20190731172756.flv?auth_key=1564643800-efc1f64efb0d1d8fab35f0fe8c823a34”}, …]
   }
}

4.Get Snapshot

Description

This API is used to get snapshot of the IPC.

Request link

https://192.168.0.1/openapi/media/getSnapshot, 192.168.0.1 should be replaced by the IP address of the IPC.

Request Parameters

No private parameter for this API, please refer to Public Parameters for more details.

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result,
possible return codes are 0, 1, 3, 5, 7, 233, see Error Code for further details.
snapshot_urlstringDownload address of the snapshot.

Request Example

POST /openapi/media/getSnapshot HTTP/1.1
Host: 192.168.0.1
Content-Type: application/x-www-form-urlencoded

app_id=mdk923idkf&random=289192×tamp=1564565937&sign=IDKNFLK392038KDS932K

Response Example

{
   “code”:              0,
   “data”: {
      “snapshot_url”:  “https://192.168.0.1/tmp/snapshot/FM0101122334455_20190726162335.jpg?auth_key=1564129415-215f61f3c5f552c5bf8f43ccef5c66a9”
  }
}

5.Get Video Clip

Description

Get a video clip before and after a period of time.

When this api called, the IPC will get a video clip which the period is a multiple of 4 seconds. The spanning of the video clip depends on the parameters passed in. The return parameter of the api is the download link of the video clip.

The download link of the video clip will take effect in 4 to 12 seconds. The Effective time is related to parameters passed in.

Request link

https://192.168.0.1/openapi/media/getCurVideos

Request Parameters

Blow are private parameters for this API, please refer to Public Parametersfor more details.

ParameterTypeDescriptionRequiredExample
precedingintTime period before current. 0, 4, and 8 allowed only. Y0
followingint Time period after current. 0, 4, and 8 allowed only. Y8

Response Parameters

ParameterTypeDescription
codeintReturn code, represent the request result, possible return codes are 0, 1, 2, 3, 5, 7, 236, 237, see Error Code for further details.
urlstringDownload link of the video clip, which will take effect after 4 to 12 seconds.

Request Example

POST /openapi/media/getCurVideos HTTP/1.1
Host: 10.10.61.206
Content-Type: application/json
Content-Length: 111
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,en,*
User-Agent: Mozilla/5.0
app_id=123&timestamp=1585743081&random=7783515117&following=0&preceding=0&sign=F4A04BDBE60D9C656A23CD945F703DA2

Response Example

{
“data”:
{
“url”:”https://10.10.63.19/mnt/sd-card/video_slicer/1585741874923_0_0.flv?auth_key=1585741878-c41f9a8751fe0c259b3d00b3842aa668″
},
“code”:0
}