Methods
#
(static) getEndpoint() → {String}
Get the current Director API endpoint where requests will be sent.
By default, https://director.wowza.com is the current API endpoint.
#
(static) getLiveDomain() → {String}
Get the current WebSocket live domain.
By default, it is empty, which corresponds to not parsing the Director response.
Returns:
The WebSocket live domain.
-
Type
-
String
#
(async, static) getPublisher(options, streamNameopt, streamTypeopt) → {Promise.<WowzaDirectorResponse>}
Get the publisher connection data.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
options |
DirectorPublisherOptions
|
String
|
|
|
Available publishing options. |
streamName |
String
|
<optional>
|
null
|
Deprecated. Use the options parameter instead. |
streamType |
"WebRtc"
|
"Rtmp"
|
<optional>
|
|
Deprecated. Use the options parameter instead. |
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)
#
(async, static) getSubscriber(options, streamAccountIdopt, subscriberTokenopt) → {Promise.<WowzaDirectorResponse>}
Get the subscriber connection data.
Parameters:
Name |
Type |
Attributes |
Default |
Description |
options |
DirectorSubscriberOptions
|
String
|
|
|
Available subscription options. |
streamAccountId |
String
|
<optional>
|
null
|
Deprecated. Use the options parameter instead. |
subscriberToken |
String
|
<optional>
|
null
|
Deprecated. Use the options parameter instead. |
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)
#
(static) setEndpoint(url)
Set the Director API endpoint where requests will be sent.
Parameters:
Name |
Type |
Description |
url |
String
|
The new Director API endpoint. |
#
(static) setLiveDomain(domain)
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. |