Last Updated on : 2021-08-17 06:33:54download
Tuya IoT Platform provides real-time video access of HLS protocol for IoT devices that are capable of transmitting audio and video.
Function description
The user can get real-time video links to the HLS protocol.
API address
POST /v1.0/users/{uid}/devices/{device_id}/stream/actions/allocate
Request parameter
Parameter | Type | Location | Description | Required |
---|---|---|---|---|
type | String | BODY | Real-time video protocol. The fixed value of the HLS protocol is hls . |
Yes |
Response parameter
Parameter | Type | Description |
---|---|---|
result | Url |
Decryption key to the cloud storage video |
success | Boolean | Status of the response result |
t | Long | The 10-bit timestamp of the response result, accurate to a millisecond. |
Url
Parameter | Type | Description |
---|---|---|
url | String | Real-time video address |
Request example
{
"type": "hls"
}
Response example
{
"result": {
"url": "https://wework1.wgine.com:554/hls/6cf2b6d2b09a2f8597gudm/bu4fsmh525q955j6djugBCKwOc8MJioR8BzQ63Yb.m3u8?signInfo=J%2FnrpQ1xQk5rcJc7TsGc7h7AAklEodbn0yDxm90dT0PtAl5lyB7uwq7%2Br3J0%2FeV0PixGQXys%2FLkCKr6svF3whoMVb40FEcv254VrLRdco8XeZThMAkpyL%2Fkx5Nzl8%2Fz4Jenciq%2FKiQDnap3yVvWwyub73NEzMpx4JA6a5rRZhg****"
},
"success": true,
"t": 1602813530973
}
Web front-end
Web back-end
Tuya IoT Platform
Log in to the Cloud Development Platform and get Access ID and Access Secret in the project information.
Update Access ID and Access Secret to clientId
and secret
in the webrtc.json
file respectively.
Update authorization mode and information.
easy
auth
Enter deviceId
. Select an IPC in the Tuya Smart app and check the device ID.
Download the source code from GitHub. In the root directory of the source code, execute go get
and then execute go build
.
Execute ./webrtc-demo-go
.
Open http://localhost:3333/api/stream/hls
with Chrome and get the HLS play address.
Enable the network in VLC in 30 seconds, and enter the HLS play address to play HLS live stream.
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback