Class: MediaStreams

MediaStreams(scene, htmlElementName)

WebRTC video/audio streaming support, intended to be overridden by implementations. Provides interface to WorldManager, that manages all clients and their streams.

Constructor

new MediaStreams(scene, htmlElementName)

Parameters:
Name Type Description
scene
htmlElementName
Source:

Classes

MediaStreams

Members

instance

There can be only one
Source:

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. Intended to be overridden, default implementation throws error.
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: