Usage
Requesting a stream
You can request a stream by sending a POST request to the /stream endpoint.
The request body should contain the information
about the target to send the stream to.
See the API documentation for more details.
For example, you can use curl to do that:
curl \
--request POST \
--header "Content-Type: application/json" \
--data '{"srt": {"host": "example.com", "port": 12345}}' \
http://localhost:10400/stream
You should receive a response containing the port number and STUN server that you can use to connect to the stream and start sending audio.
Sending audio
You can send audio to stream using any
WHIP
client.
Remember to use the port you received in the previous step to connect to the stream.
For example, from the browser you can do that using the
@eyevinn/whip-web-client
package:
import { WHIPClient } from "@eyevinn/whip-web-client";
const endpoint = "http://localhost:10401/whip/endpoint";
const client = new WHIPClient({ endpoint });
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
await client.setIceServersFromEndpoint();
await client.ingest(stream);
Alternatively, from the server side,
you can use GStreamer for that:
gst-launch-1.0 \
audiotestsrc \
! \
audioconvert \
! \
audioresample \
! \
audio/x-raw \
! \
queue \
! \
whipclientsink \
signaller::whip-endpoint="http://localhost:10401/whip/endpoint"
Ping
You can check the status of the service by sending
either a GET or HEAD request to the /ping endpoint.
The service should respond with a 204 No Content status code.
For example, you can use curl to do that:
curl --request HEAD --head http://localhost:10400/ping
Server-Sent Events
You can subscribe to
Server-Sent Events (SSE)
by sending a GET request to the /sse endpoint.
The service should send you the events as they happen.
For example, you can use curl to do that:
curl --request GET --no-buffer http://localhost:10400/sse
OpenAPI
You can view the OpenAPI
documentation made with Scalar
by navigating to the /openapi endpoint in your browser.
You can also download the specification in JSON format
by sending a GET request to the /openapi/openapi.json endpoint.
For example, you can use curl to do that:
curl --request GET http://localhost:10400/openapi/openapi.json