Class: MediaStreams

MediaStreams(scene, htmlElementName)

WebRTC video/audio streaming support. Implements OpenVidu streaming, subclasses may provide different implementations. WorldManager manages all clients and their streams.

Constructor

new MediaStreams(scene, htmlElementName)

Parameters:
Name Type Description
scene
htmlElementName
Source:

Classes

MediaStreams

Methods

attachAudioStream()

Attaches an audio stream to a mesh (e.g. avatar)
Source:

attachVideoStream()

Attaches a videoStream to a VideoAvatar
Source:

(async) connect(token)

Connect to server with given parameters, calls init.
Parameters:
Name Type Description
token whatever is needed to connect and initialize the session
Source:

getClientId()

Retrieve VRSpace Client id from WebRTC subscriber data
Source:

getStream()

Retrieve MediaStream from subscriber data
Source:

(async) init(callback)

Initialize streaming and attach event listeners. This implementation initializes OpenVidu session.
Parameters:
Name Type Description
callback executed when new subscriber starts playing the stream
Source:

playStream()

function to play video of a client
Source:

publish(htmlElement)

Start publishing local video/audio
Parameters:
Name Type Description
htmlElement needed only for local feedback (testing)
Source:

publishAudio()

Enable/disable (mute) audio
Source:

publishVideo()

Enable/disable video
Source:

removeClient()

Remove a client, called when client leaves the space
Source:

streamingStart()

Called when a new stream is received. Tries to find an existing client, and if found, calls attachAudioStream and attachVideoStream.
Source:

streamToMesh()

Called when a new client enters the space. Tries to find an existing stream, and if found, calls attachAudioStream and attachVideoStream.
Source: