Nodeflux Central
Live Streaming

API Reference: Live Streaming

Endpoint untuk menonton stream lewat HTTP-TS, melihat stream dan koneksi klien, serta registrasi publisher RTMP bertoken.

Liodra tidak memiliki otentikasi API sendiri; batasi akses port 9080 di tingkat jaringan atau reverse proxy. Basis URL memakai variabel LIODRA_API_URL (default http://localhost:9080). Endpoint di halaman ini aktif pada semua konfigurasi (tidak bergantung flag fitur).


Menonton

Tonton Stream Live (HTTP-TS)

GET
/api/v1/play/ts/{path}

Path Parameters

path*string

{app}/{name}, mendukung app bertingkat (live/hls/camera_01) dan VoP (vop/youtube/youtube_test).

Query Parameters

transcode?boolean

true/1 mengaktifkan transcode HEVC ke H.264. Diabaikan untuk stream H.264.

Response Body

video/mp2t

application/json

application/json

application/json

curl -X GET "http://localhost:9080/api/v1/play/ts/live/camera_front?transcode=true"
"string"
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}
{  "success": false,  "error": "Failed to connect to media engine"}
{  "success": false,  "error": "Too many on-demand streams, retry shortly",  "details": "on-demand process limit reached (32/32 active)"}

Stream dan Klien

Daftar Stream Aktif

GET
/api/v1/streams

Query Parameters

start?integer

Indeks awal paginasi.

Default0
count?integer

Jumlah maksimum hasil.

Default10

Response Body

application/json

application/json

curl -X GET "http://localhost:9080/api/v1/streams"

{  "success": true,  "data": {    "streams": [      {        "app": "live",        "name": "camera_front",        "publish_url": "rtmp://127.0.0.1:1935/live/camera_front",        "clients": 1,        "video": {          "codec": "H264",          "width": 1920,          "height": 1080        }      },      {        "app": "vod",        "name": "9876543210ab",        "publish_url": "rtmp://127.0.0.1:1935/vod/9876543210ab?vhost=vod",        "clients": 1,        "video": {          "codec": "HEVC",          "width": 1920,          "height": 1080        }      }    ]  }}

{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}

Daftar Klien

GET
/api/v1/clients

Response Body

application/json

application/json

curl -X GET "http://localhost:9080/api/v1/clients"
{  "success": true,  "data": {    "publishers": [      {        "id": "54321",        "vhost": "__defaultVhost__",        "name": "camera_front",        "stream": "vid-123456",        "ip": "127.0.0.1",        "type": "fmle-publish",        "publish": true,        "alive": 125.5,        "app": "live",        "play_url": "/api/v1/play/ts/live/camera_front?transcode=true",        "send_bytes": 5000,        "recv_bytes": 1000000,        "kbps": {          "recv_30s": 2500,          "send_30s": 0        },        "device": {          "name": "camera_front",          "url": "rtsp://admin:***@192.168.1.100:554/stream1",          "scheme": "rtsp",          "channel": "live",          "silent_audio": true,          "status": "active"        }      }    ],    "subscribers": [      {        "id": "98765",        "vhost": "__defaultVhost__",        "name": "camera_front",        "stream": "vid-123456",        "ip": "192.168.1.50",        "type": "flv-play",        "publish": false,        "alive": 60,        "app": "live",        "play_url": "/api/v1/play/ts/live/camera_front?transcode=true",        "send_bytes": 0,        "recv_bytes": 500000,        "kbps": {          "recv_30s": 0,          "send_30s": 1200        }      }    ]  }}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}

Detail Klien

GET
/api/v1/clients/{id}

Path Parameters

id*string

ID klien (lihat GET /api/v1/clients).

Response Body

application/json

application/json

application/json

curl -X GET "http://localhost:9080/api/v1/clients/54321"
{  "success": true,  "data": {    "client": {      "id": "54321",      "vhost": "__defaultVhost__",      "name": "camera_front",      "stream": "vid-123456",      "ip": "127.0.0.1",      "type": "fmle-publish",      "publish": true,      "alive": 125.5,      "app": "live",      "play_url": "/api/v1/play/ts/live/camera_front?transcode=true",      "send_bytes": 5000,      "recv_bytes": 1000000,      "kbps": {        "recv_30s": 2500,        "send_30s": 0      },      "device": {        "name": "camera_front",        "url": "rtsp://admin:***@192.168.1.100:554/stream1",        "scheme": "rtsp",        "channel": "live",        "silent_audio": true,        "status": "active",        "publish_url": "rtmp://127.0.0.1:1935/live/camera_front",        "message": "string",        "created_at": "2019-08-24T14:15:22Z",        "updated_at": "2019-08-24T14:15:22Z",        "last_seen": "2019-08-24T14:15:22Z",        "error_count": 0,        "restart_count": 0,        "suspended": false,        "uptime": "2h15m30s",        "warning": "string",        "srs_stream": {          "id": "12345",          "vhost": "__defaultVhost__",          "app": "live",          "name": "camera_front",          "video": {            "codec": "H264",            "profile": "High",            "level": "4.0"          },          "audio": {            "codec": "AAC",            "sample_rate": 44100,            "channels": 2          },          "clients": 3        }      }    }  }}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}

Putuskan Klien

DELETE
/api/v1/clients/{id}

Path Parameters

id*string

Response Body

application/json

application/json

application/json

curl -X DELETE "http://localhost:9080/api/v1/clients/54321"
{  "code": 0}
{  "code": 2049}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}

Otentikasi RTMP

Registrasi Publisher

POST
/api/v1/register

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "http://localhost:9080/api/v1/register" \  -H "Content-Type: application/json" \  -d '{    "device_name": "lobby-cam-01",    "channel": "live/mobile"  }'
{  "success": true,  "data": {    "device_name": "lobby-cam-01",    "channel": "live/mobile",    "rtmp_url": "rtmp://liodra.example.com:1935/live/mobile/lobby-cam-01?token=a1b2c3d4e5f60718293a4b5c6d7e8f90"  }}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}
{  "success": false,  "error": "Device already publishing"}
{  "success": false,  "error": "Not found",  "details": "Resource does not exist"}

On this page