Creates and opens audio stream to camera. This stream will be available at URL: . If stream with specified streamId already exists, returns error.
| fields | type | Required | description |
|---|---|---|---|
| streamId | string | + | Audio stream id |
| request | object | + | |
| request.format | enum | – | Audio stream format. Possible values: hv, fc. Default: hv |
| request.* | Depends on request.format | ||
| user_data | any | – | Any data which will be passed to stream event handlers. Can be of any valid type: string, number, boolean, array, object. If user_data is nil, the value will not be set. |
| fields | type | Required | description |
|---|---|---|---|
| request.url | string | + | HTTP URL |
| request.type | string | + | HTTP request method. Possible values: , , , |
| request.headers | object | – | |
| request.headers. |
string | + | Header name |
| request.headers. |
string | + | Header value |
| request.user | string | – | User for Basic HTTP Authentication |
| request.password | string | – | Password for Basic HTTP Authentication |
| fields | type | Required | description |
|---|---|---|---|
| request.address | string | + | Camera address |
| request.port | int | + | Camera audio stream port |
| request.magic | string | + | Magic token |
| request.user | string | + | Camera user |
| request.password | string | + | Camera password |
local cameras = require("cameras")
cameras.create_audio_stream( "588b7eb528b12d03be86f36f", {
type = "PUT",
url = "http://192.168.42.55:3580/ISAPI/System/TwoWayAudio/channels/1/audioData",
user = "admin",
password = "password",
headers = {
["Content-Type"] = "application/octet-stream",
["Content-Length"] = "0",
Connection = "keep-alive"
}
}
)
local cameras = require("cameras")
cameras.create_audio_stream( "588b7eb528b12d03be86f36e", {
format = "fc",
address = "192.168.0.212",
port = 49587,
magic = "EZLO"
user = "admin",
password = "password",
}
)