/

Consuming Services As a Broadcaster


Once you have an active cluster for streaming the next step is for a publisher client to start broadcasting to it.

The problem here is that the broadcaster may not know the address of the origin server that they need to broadcast stream to. This is where Stream Manager comes into play again.

Broadcaster Stream Request

Stream Manager provides a public REST endpoint for providing stream information to broadcasters and subscribers based on requester's role in the system. The broadcaster client will need to make a REST call to Stream Manager using a scope name, stream name and the action parameter (broadcast).

  • Scope name is the Red5 application/context name that a client connects to. The default scope name to be used is live
  • Stream name is the name of the publishing stream
  • Action is a query string parameter which defines the client's request type: broadcast or subscribe

Requesting Stream Broadcast Information

Use stream manager’s READ STREAM REST API to request for an origin server

The combination of scope name and stream name should be unique for each streaming event.

Request Format

http(s)://{host}:{port}/streammanager/api/<api-version>/event/{scopeName}/{streamName}?action=broadcast

Response Format

{
  "name": "<stream-name>",
  "scope": "<stream-scope>",
  "serverAddress": "<origin-host-address>",
  "region": "<region-code>"
}

Connecting To Server To Broadcast

Having received a successful response from stream manager with stream broadcast information we can now publish the stream using a subscriber client.

The stream publish information received from the REST response can be used by different types of publisher client(s) as shown below.

Android Client

Property NameValue
host
context
port8554
stream

iOS Client

Property NameValue
host
context
port8554
stream

RTMP Client

Property NameValue
Connection URLrtmp://:1935/
stream

WebRTC Stream Manager Proxy Publishing

WebRTC requires using the Stream Manager proxy feature to bypass the secure origin requirement, to be able to publish/subscribe.

Stream Manager can multiplex between its regular responsibilities as well as as being a proxy for WebRTC publish/subscribe operations. Thus for WebRTC clients the application is streammanager instead of any other Red5 Pro webapp.

To know more about proxy and configuring WebRTC client to work with proxy please see the Stream Manager Proxy Guide.

Example references for publishers