Constructor
new BaseWebRTC(streamName, tokenGenerator, loggerInstance, autoReconnect)
Name | Type | Description |
---|---|---|
streamName | String | Deprecated: Millicast existing stream name. Use tokenGenerator instead. |
tokenGenerator | tokenGeneratorCallback | Callback function executed when a new token is needed. |
loggerInstance | Object | Logger instance from the extended classes. |
autoReconnect | Boolean | Enable auto reconnect. |
- Source
Extends
- EventEmitter
Methods
getRTCPeerConnection() → {RTCPeerConnection}
Get current RTC peer connection.
- Source
Object which represents the RTCPeerConnection.
- Type:
- RTCPeerConnection
isActive() → {Boolean}
Get if the current connection is active.
- Source
- True if connected, false if not.
- Type:
- Boolean
(async) reconnect(dataopt)
Reconnects to last broadcast.
Name | Type | Attributes | Description |
---|---|---|---|
data | Object | <optional> | This object contains the error property. It may be expanded to contain more information in the future. |
Name | Type | Description |
---|---|---|
error | String | The value sent in the first reconnect event within the error key of the payload |
- Source
setReconnect()
Sets reconnection if autoReconnect is enabled.
- Source
stop()
Stops connection.
- Source
Events
reconnect
Emits with every reconnection attempt made when an active stream stopped unexpectedly.
- Object
Name | Type | Description |
---|---|---|
timeout | Number | Next retry interval in milliseconds. |
error | Error | Error object with cause of failure. Possible errors are:
|
- Source