Extends
Classes
Members
audioSource
Audio source to use, default undefined (auto). @type {boolean|undefined}
- Inherited From:
- Source:
clients
Currently tracked clients, maintained externally (e.g. by calling streamToMesh method) @type {Array.}
- Inherited From:
- Source:
debug
Verbose WebRTC? Default false. @type {boolean}
- Inherited From:
- Source:
htmlElementName :HTMLElement
Type:
- HTMLElement
- Inherited From:
- Source:
instance
There can be only one @type { MediaStreams }
- Inherited From:
- Source:
publishingAudio
Currently publishing audio? @type {boolean}
- Inherited From:
- Source:
publishingVideo
Currently publishing video? @type {boolean}
- Inherited From:
- Source:
soundProperties
Default values for streaming sound, see https://doc.babylonjs.com/typedoc/interfaces/BABYLON.ISoundOptions
- Inherited From:
- Source:
startAudio
Auto start audio? Default true. @type {boolean}
- Inherited From:
- Source:
startVideo
Auto start video? Default false. @type {boolean}
- Inherited From:
- Source:
streamListeners
Stream listeners, currently used only for screen sharing
- Inherited From:
- Source:
subscribers
Currently tracked streams, maintained by this class (e.g. streaminStart) .
- Inherited From:
- Source:
videoSource
Video source to use, default false (disabled). @type {boolean|undefined}
- Inherited From:
- Source:
Methods
(static) getInstance() → {OpenViduStreams}
- Source:
Returns:
- Type
- OpenViduStreams
attachAudioStream(mesh, mediaStream, options)
Creates babylon Sound object from the stream with default parameters, and attaches it to the mesh (e.g. avatar).
Called internally by streamToMesh.
Parameters:
Name | Type | Description |
---|---|---|
mesh |
babylon mesh to attach to | |
mediaStream |
MediaStream to attach | |
options |
custom sound options, defaults to soundProperties, see https://doc.babylonjs.com/typedoc/interfaces/BABYLON.ISoundOptions |
- Inherited From:
- Source:
Returns:
created babylon Sound object, or null if stream contains no audio tracks
attachVideoStream(client)
Attaches a videoStream to a VideoAvatar. Also attaches video properties change event handler, to display video/alt text.
Called internally by streamToMesh.
Parameters:
Name | Type | Description |
---|---|---|
client |
Client | Client that streams |
- Inherited From:
- Source:
(async) connect(token)
Connect to server with given parameters, calls init with callback to streamingStart method.
Parameters:
Name | Type | Description |
---|---|---|
token |
string | whatever is needed to connect and initialize the session |
- Inherited From:
- Source:
getClientData() → {SessionData}
Returns session data embedded in the session, used internally.
- Inherited From:
- Source:
Returns:
- Type
- SessionData
getClientId() → {number}
Retrieve VRSpace Client id from WebRTC subscriber data
- Inherited From:
- Source:
Returns:
- Type
- number
getStream() → {MediaStream}
Retrieve MediaStream from subscriber data
- Inherited From:
- Source:
Returns:
- Type
- MediaStream
(async) init(callback)
Method connects calls init
Parameters:
Name | Type | Description |
---|---|---|
callback |
* | function that gets called when stream is created (subscriber,false) and starts playing (subscriber,true) |
- Overrides:
- Source:
parseToken(token)
Parse the passed token
Parameters:
Name | Type | Description |
---|---|---|
token |
string |
- Inherited From:
- Source:
playStream()
Function to play video of a client, passed client and stream. Defaults to uknownStream method.
- Inherited From:
- Source:
publish(htmlElement)
Start publishing local video/audio
FIXME opevidu implementation
Parameters:
Name | Type | Description |
---|---|---|
htmlElement |
string | undefined | needed only for local feedback (testing) |
- Inherited From:
- Source:
publishAudio(enabled)
Enable/disable (mute) audio
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean |
- Inherited From:
- Source:
publishVideo(enabled)
Enable/disable video
Parameters:
Name | Type | Description |
---|---|---|
enabled |
boolean |
- Inherited From:
- Source:
removeClient(client)
Remove a client, called when client leaves the space
Parameters:
Name | Type | Description |
---|---|---|
client |
Client |
- Inherited From:
- Source:
(async) shareScreen(endCallback)
Share screen implementation
Parameters:
Name | Type | Description |
---|---|---|
endCallback |
* | called when screen sharing stops |
- Source:
stopSharingScreen()
Stops the sharing.
- Source:
streamingStart(subscriber, playing)
Called when a new stream is received, set up as callback in default connect and init method.
Tries to find an existing client, and if found, calls attachAudioStream and attachVideoStream.
Parameters:
Name | Type | Description |
---|---|---|
subscriber |
* | |
playing |
boolean | false if stream is created but not yet playing, true when starts playing |
- Inherited From:
- Source:
streamToMesh(client, mesh)
Called when a new client enters the space (in WorldManager).
Tries to find an existing stream, and if found, calls attachAudioStream and attachVideoStream.
Parameters:
Name | Type | Description |
---|---|---|
client |
Client | |
mesh |
* | babylonjs mesh |
- Inherited From:
- Source:
unknownStream()
Default play stream implementation - logs error message.
- Inherited From:
- Source: