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 the stream to. This is where Stream Manager comes into play again.
Stream Manager provides a public REST endpoint for providing stream information to broadcasters and subscribers based on the 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 liveStream name
is the name of the publishing streamAction
is a query string parameter that defines the client's request type:broadcast
orsubscribe
Requesting Stream Broadcast Information
Use stream manager’s READ STREAM REST API to request 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 the 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 Name | Value |
---|---|
host | |
context | |
port | 8554 |
stream |
iOS Client
Property Name | Value |
---|---|
host | |
context | |
port | 8554 |
stream |
RTMP Client
Property Name | Value |
---|---|
Connection URL | rtmp:// |
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.
To know more about proxy and configuring WebRTC clients to work with proxy please see the Stream Manager Proxy Guide.