Skip to main content
Skip table of contents

Создание потока

Создание потока

Поток будет создан, если будет найден доступный медиасервер. Про алгоритм поиска см. Поиск доступного медиасервера

POST /api/admin/v1/camera/{camera}/stream

Параметры метода

int camera, уникальный идентификатор камеры


string url, rtsp url, который будет передан медиасерверу


string type, тип потока

200 OK

Возвращает объект потока

JSON
{
    "id": 1002,
    "type": "high",
    "camera_id": 948,
    "status": "active",
    "url": "rtsp://admin:admin@127.0.0.1:554/Streaming/Channels/101?transportmode=unicast&profile=Profile_1",
    "bitrate": 1519,
    "resolution": "2560x1440",
    "output_rate": 0,
    "ip": "127.0.0.1",
    "uuid": "bdbfba39-aee9-47bd-a790-edafd22fa829",
    "sound": "tracks-v1",
    "streams_count": 0,
    "server": {
        "id": 5,
        "type": "media_server_v2",
        "schema": "https",
        "domain": "labMS7.vms.local",
        "internal": "8080",
        "external": "8443",
        "m4f": "8443",
        "rtsp": "5554",
        "publish": "555",
        "traffic_in": 17690,
        "traffic_out": 0,
        "status": 1,
        "is_enabled": 1,
        "is_main": 0,
        "has_cache": 0,
        "proxy": ".vms.local",
        "created_at": "2021-05-27 16:16:26",
        "updated_at": "2022-06-22 13:16:02",
        "group_type": "all",
        "can_delete": false,
        "streams_limit": 6000,
        "bitrate_limit": 600000,
        "extra": {
            "io": {
                "read_rate": 0,
                "read_bytes": 0,
                "write_rate": 0,
                "write_bytes": 0
            },
            "cpu": {
                "total": 8,
                "usage": 10,
                "stime_sec": 16275,
                "utime_sec": 16275
            },
            "mem": {
                "rss": 490422272,
                "share": 9711616,
                "usage": 2481070080
            },
            "net": {
                "in_bitrate": 18114960,
                "out_bitrate": 0
            },
            "drives": {
                "/": {
                    "fs": "ext4",
                    "mount": "/",
                    "inode_free": 1475251,
                    "inode_total": 1605632,
                    "capacity_free": 1799868416,
                    "capacity_total": 25759584256
                },
                "/boot": {
                    "fs": "ext4",
                    "mount": "/boot",
                    "inode_free": 65220,
                    "inode_total": 65536,
                    "capacity_free": 806674432,
                    "capacity_total": 1023303680
                },
                "/storage": {
                    "fs": "ext4",
                    "mount": "/storage",
                    "inode_free": 32761736,
                    "inode_total": 32768000,
                    "capacity_free": 401537396736,
                    "capacity_total": 527371075584
                }
            },
            "server": {
                "ip4": "192.168.200.19",
                "name": "MS-21.03-lts",
                "build": "44ce34f",
                "uptime": 517617,
                "startat": 1655375345,
                "version": "21.03",
                "hostname": "labMS7.vms.local",
                "revision": "lts",
                "timestamp": "20220616091725"
            },
            "cluster": {
                "id": "3",
                "node": "7",
                "enable": "true",
                "hostname": "labMS7.vms.local"
            },
            "license": {
                "own": "Vms",
                "type": "enterprise",
                "issued": 1687428962
            },
            "streams": {
                "total": 26,
                "active": 10,
                "clients": 0
            },
            "storages": {
                "/storage": {
                    "fs": "",
                    "err": 0,
                    "name": "default",
                    "mount": "/storage",
                    "inode_free": 32761736,
                    "inode_total": 32768000,
                    "capacity_free": 401537396736,
                    "capacity_total": 527371075584
                }
            }
        }
    },
    "sub_servers": [
        {
            "id": 6,
            "type": "media_server_v2",
            "schema": "https",
            "domain": "labMS8.vms.local",
            "internal": "8080",
            "external": "8443",
            "m4f": "8443",
            "rtsp": "5554",
            "publish": "555",
            "traffic_in": 9223,
            "traffic_out": 0,
            "status": 1,
            "is_enabled": 1,
            "is_main": 0,
            "has_cache": 0,
            "proxy": ".vms.local",
            "created_at": "2021-05-27 16:17:06",
            "updated_at": "2022-06-22 13:16:02",
            "group_type": "all",
            "can_delete": false,
            "streams_limit": 6000,
            "bitrate_limit": 600000,
            "extra": {
                "io": {
                    "read_rate": 0,
                    "read_bytes": 0,
                    "write_rate": 0,
                    "write_bytes": 0
                },
                "cpu": {
                    "total": 5,
                    "usage": 6,
                    "stime_sec": 11148,
                    "utime_sec": 11148
                },
                "mem": {
                    "rss": 681906176,
                    "share": 10559488,
                    "usage": 2818531328
                },
                "net": {
                    "in_bitrate": 9444376,
                    "out_bitrate": 0
                },
                "drives": {
                    "/": {
                        "fs": "ext4",
                        "mount": "/",
                        "inode_free": 1472861,
                        "inode_total": 1605632,
                        "capacity_free": 18185670656,
                        "capacity_total": 25759584256
                    },
                    "/boot": {
                        "fs": "ext4",
                        "mount": "/boot",
                        "inode_free": 65220,
                        "inode_total": 65536,
                        "capacity_free": 806674432,
                        "capacity_total": 1023303680
                    },
                    "/storage": {
                        "fs": "ext4",
                        "mount": "/storage",
                        "inode_free": 32747098,
                        "inode_total": 32768000,
                        "capacity_free": 356458954752,
                        "capacity_total": 527371075584
                    }
                },
                "server": {
                    "ip4": "192.168.200.20",
                    "name": "MS-21.03-lts",
                    "build": "44ce34f",
                    "uptime": 271204,
                    "startat": 1655621758,
                    "version": "21.03",
                    "hostname": "labMS8.vms.local",
                    "revision": "lts",
                    "timestamp": "20220616091725"
                },
                "cluster": {
                    "id": "3",
                    "node": "8",
                    "enable": "true",
                    "hostname": "labMS8.vms.local"
                },
                "license": {
                    "own": "Vms",
                    "type": "enterprise",
                    "issued": 1687428962
                },
                "streams": {
                    "total": 26,
                    "active": 13,
                    "clients": 0
                },
                "storages": {
                    "/storage": {
                        "fs": "",
                        "err": 0,
                        "name": "default",
                        "mount": "/storage",
                        "inode_free": 32747098,
                        "inode_total": 32768000,
                        "capacity_free": 356458954752,
                        "capacity_total": 527371075584
                    }
                }
            }
        }
    ],
    "transfer_servers": [],
    "transfer_sub_servers": [],
    "created_at": "2022-06-16 17:55:46",
    "updated_at": "2022-06-22 13:16:04",
    "is_preview_from_server": true,
    "is_archive_from_server": null,
    "is_enabled": true,
    "source": "manual",
    "is_sound_enabled": false,
    "reconnect_attempt": 0,
    "reconnect_total": 0,
    "reconnect_time": null,
    "disconnections_count": 0,
    "is_actual": true
}

401 Unauthorized

Токен авторизации не передан или не валидный Получение токена

402 Payment Required

Ошибка лицензии

422 Unprocessable Entity

Возвращает JSON объект с ошибкой. Валидация

JSON
{
    "message": "Тут не будет информативного сообщения",
    "errors": {
        "any_key": [
            "Тут будет описана причина ошибки"
        ]
    }
}
cURL
BASH
curl -k --request POST \
	--url 'https://your-domain/api/admin/v1/camera/{camera}/stream' \
	--header 'Content-Type: application/json' \
	--header 'Accept: application/json' \
	--data '{
    "camera": 0,
    "url": "string",
    "type": "string"
}'
PHP
PHP
$data = array (
  'camera' => 0,
  'url' => 'string',
  'type' => 'string',
);
$context = stream_context_create([
	'ssl'=>['verify_peer' => false],
	'http' => [
		'method' => 'POST',
		'header' => "Content-Type: application/json\r
Accept: application/json",
		'content'=>json_encode($data)
	]
]);
$result = file_get_contents('https://your-domain/api/admin/v1/camera/{camera}/stream', false, $context);
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.