Director

Simplify API calls to find the best server and region to publish and subscribe to. For security reasons all calls will return a JWT token for authentication including the required socket path to connect with.

You will need your own Publishing token and Stream name, please refer to Managing Your Tokens.

Source:

Methods

# (inner) getEndpoint() → {String}

Get current Director API endpoint where requests will be sent. Default endpoint is 'https://director.wowza.com'.

Source:
Returns:

The API base url.

Type
String

# (inner) getLiveDomain() → {String}

Get current Websocket Live domain. By default is empty which corresponds to not parse the Director response.

Source:
Returns:

The WebSocket live domain.

Type
String

# (inner) getPublisher(options) → {Promise.<WowzaDirectorResponse>}

Get the publisher connection data.

Parameters:
Name Type Description
options DirectorPublisherOptions

Wowza options.

Source:
Returns:

A promise object that represents the result of getting the publishing connection path.

Type
Promise.<WowzaDirectorResponse>
Examples
const response = await Director.getPublisher(options)
import { Publish, Director } from '@wowzamediasystems/sdk-rts'

//Define getPublisher as callback for Publish
const streamName = "My Wowza Stream Name"
const token = "My Wowza publishing token"
const tokenGenerator = () => Director.getPublisher({token, streamName})

//Create a new instance
const wowzaPublish = new Publish(streamName, tokenGenerator)

//Get MediaStream
const mediaStream = getYourMediaStreamImplementation()

//Options
const broadcastOptions = {
   mediaStream: mediaStream
 }

//Start broadcast
await wowzaPublish.connect(broadcastOptions)

# (inner) getSubscriber(options) → {Promise.<WowzaDirectorResponse>}

Get the subscriber connection data.

Parameters:
Name Type Description
options DirectorSubscriberOptions

Wowza options.

Returns:

A promise object that represents the result of getting the subscriber connection data.

Type
Promise.<WowzaDirectorResponse>
Examples
const response = await Director.getSubscriber(options)
import { View, Director } from '@wowzamediasystems/sdk-rts'

//Define getSubscriber as callback for Subscribe
const streamName = "My Wowza Stream Name"
const accountId = "Wowza Publisher account Id"
const tokenGenerator = () => Director.getSubscriber({streamName, accountId})
//... or for an secure stream
const tokenGenerator = () => Director.getSubscriber({streamName, accountId, subscriberToken: '176949b9e57de248d37edcff1689a84a047370ddc3f0dd960939ad1021e0b744'})

//Create a new instance
const wowzaView = new View(streamName, tokenGenerator)

//Set track event handler to receive streams from Publisher.
wowzaView.on('track', (event) => {
  addStreamToYourVideoTag(event.streams[0])
})

//View Options
const options = {
 }

//Start connection to broadcast
await wowzaView.connect(options)

# (inner) setEndpoint(url) → {void}

Set the Director API endpoint where requests will be sent.

Parameters:
Name Type Description
url String

The new Director API endpoint.

Source:
Returns:
Type
void

# (inner) setLiveDomain(domain) → {void}

Set the WebSocket live domain from the Director API response. If set to empty, it will not parse the Director response.

Parameters:
Name Type Description
domain String

The new WebSocket live domain.

Source:
Returns:
Type
void