Skip to content

Live777 HTTP API

WHIP && WHEP

POST /whip/:streamId

Response: [201]

POST /whep/:streamId

Response: [201]


PATCH /session/:streamId/:sessionId

Response: [204]

DELETE /session/:streamId/:sessionId

Response: [204]

Stream

Create a Stream

POST /api/streams/:streamId

streamId need unique id

Maybe you can use this configuration auto create stream

toml
[strategy]
# WHIP auto a stream
auto_create_whip = true
# WHEP auto a stream
auto_create_whep = true

Response: [204]

Get all Stream

GET /api/streams/

Response: [200]

  • id: String, streamId
  • createdAt: Int, timestamp
  • publish: Object(PubSub), about publisher
  • subscribe: Object(PubSub), about subscriber
  • (publish | subscribe).leaveAt: Int, timestamp
  • (publish | subscribe).sessions: Array, sessions
  • (publish | subscribe).sessions.[].id: String, sessionId
  • (publish | subscribe).sessions.[].createdAt: Int, timestamp
  • (publish | subscribe).sessions.[].state: String, RTCPeerConnection/connectionState
  • (publish | subscribe).sessions.[].cascade: Optional(Object(Cascade))
  • (publish | subscribe).sessions.[].cascade.sourceUrl: Optional(String(URL))
  • (publish | subscribe).sessions.[].cascade.targetUrl: Optional(String(URL))
  • (publish | subscribe).sessions.[].cascade.sessionUrl: String(URL)

For Example:

json
[
  {
    "id": "push",
    "createdAt": 1719326206862,
    "publish": {
      "leaveAt": 0,
      "sessions": [
        {
          "id": "08c1f2a0a60b0deeb66ee572bd369f80",
          "createdAt": 1719326206947,
          "state": "connected"
        }
      ]
    },
    "subscribe": {
      "leaveAt": 1719326206862,
      "sessions": []
    }
  },
  {
    "id": "pull",
    "createdAt": 1719326203854,
    "publish": {
      "leaveAt": 0,
      "sessions": [
        {
          "id": "41b2c52da4fb1eed5a3bff9a9a200d80",
          "createdAt": 1719326205079,
          "state": "connected",
          "cascade": {
            "sourceUrl": "http://localhost:7777/whep/web-0",
            "sessionUrl": "http://localhost:7777/session/web-0/aabc02240abfc7f4800e8d9a6f087808"
          }
        }
      ]
    },
    "subscribe": {
      "leaveAt": 1719326203854,
      "sessions": []
    }
  },
  {
    "id": "web-0",
    "createdAt": 1719326195910,
    "publish": {
      "leaveAt": 0,
      "sessions": [
        {
          "id": "0dc47d8da8eb0a64fe40f461f47c2a36",
          "createdAt": 1719326196264,
          "state": "connected"
        }
      ]
    },
    "subscribe": {
      "leaveAt": 0,
      "sessions": [
        {
          "id": "aabc02240abfc7f4800e8d9a6f087808",
          "createdAt": 1719326204997,
          "state": "connected"
        },
        {
          "id": "dab1a9e88b2400cfd4bcfb4487588ef3",
          "createdAt": 1719326206798,
          "state": "connected",
          "cascade": {
            "targetUrl": "http://localhost:7777/whip/push",
            "sessionUrl": "http://localhost:7777/session/push/08c1f2a0a60b0deeb66ee572bd369f80"
          }
        },
        {
          "id": "685beee8650b761116b581a4a87ca9b9",
          "createdAt": 1719326228314,
          "state": "connected"
        }
      ]
    }
  }
]

Destroy a Stream

DELETE /api/streams/:streamId

Response: [204]

Cascade

POST /api/cascade/:streamId

Request:

json
{
  "token": "",
  "sourceUrl": "",
  "targetUrl": "",
}
  • token: Option, auth header
  • sourceUrl: Option. if has, use pull mode
  • targetUrl: Option. if has, use pull mode
  • sourceUrl and targetUrl at the same time can only one

Released under the MPL-2.0 License.