Class: Conference

Conference(url, listenernullable)

Conference is a virtual space where participants can communicate to each other in real-time using audio, video and text. Conference class represents an existent conference from point of view of local participant. To instantiate Conference we need an URL of the conference and optionally ConferenceListener which will be notified about all the changes in the conference:

let conferenceURI = "https://api.mind.com/<APPLICATION_ID>/<CONFERENCE_ID>";
let conferenceListener = new MindAPI.ConferenceListener();
conferenceListener.onParticipantJoined = (participant) => {
    console.log(participant.getName() + " has joined the conference");
};
conferenceListener.onParticipantExited = (participant) => {
    console.log(participant.getName() + " has exited the conference");
};

...

let conference = new Conference(conferenceURI, conferenceListener);

The newly instantiated Conference object isn't fully operational till we complete joining and after we perform exiting. Once Conference is fully operational it can be used for getting and setting parameters of the conference itself and participants, for starting and stopping recording, and for getting conference media stream:

// The `conference` isn't fully operational till we join it
conference.join(participantToken).then(function(me) {
    let video = document.getElementById("video");
    let mediaStream = conference.getMediaStream(MindAPI.StreamingMode.VIDEO_AND_AUDIO);
    video.srcObject = mediaStream;

    ...

    conference.exit();
    // The `conference` isn't fully operational after we left it
});

Constructor

new Conference(url, listenernullable)

Creates and returns Conference object that represents the conference with a given URI. The optional second argument can be used for registering a listener which will be notified about all the changes in the conference.

Parameters:
Name Type Attributes Description
url String

The URI of the conference

listener ConferenceListener <nullable>

The conference listener to get notifications about all the changes in the conference

Classes

Conference

Methods

exit()

Leaves the conference if it has been joined. The leaving is a synchronous operation which assumes closing all connections with the server and freeing all allocated resources. After leaving all the objects related to the conference should be considered undefined and shouldn't be used.

getId() → {String}

Returns the ID of the conference. The ID is unique and never changes.

Returns:

The ID of the conference.

Type
String

getMe() → {Me}

Returns local participant on behalf of whom we are currently taking part in the Conference.

Returns:

The local participant on behalf of whom we are currently taking part in the Conference.

Type
Me

getMediaStream(mode) → {MediaStream}

This method returns MediaStream of the conference. The returned stream is a mix of all audios and videos (excluding an audio of the local participant) that participants are at the moment streaming to the conference. The videos in the MediaStream are arranged using current layout of the local participant. The returned stream could include one video track and one audio track. The track set depends on the streaming mode given as the first argument.

Parameters:
Name Type Description
mode StreamingMode

The streaming mode which determines whether the returned MediaStream should include audio and video tracks.

Returns:

The MediaStream of the conference.

Type
MediaStream

getMessages() → {Array.<Message>}

Returns the list of messages that contains all public messages (that have been sent to all participant in the conference) and all private messages (that have been addressed to the local participant only).

Returns:

The list with all public and private messages

Type
Array.<Message>

getName() → {String}

Returns the current name of the conference.

Returns:

The current name of the conference

Type
String

getNetworkQuality() → {Number}

Returns current network quality as mean opinion score. in range from 0 to 5, where 0 means no network connection at all and 5 means excellent network.

Returns:

The estimated quality of the network as a number in range from 0 to 5.

Type
Number

getParticipantById() → {Participant|null}

Returns remote participant with the given ID or null, if remote participant with the given ID wasn't found.

Returns:

The remote participant or null if it wasn't found

Type
Participant | null

getParticipants() → {Array.<Participant>}

Returns the list of all remote participants.

Returns:

The list of remote participants

Type
Array.<Participant>

getRecordingURL()

Returns personalized URL for downloading recording file. Any participant can get the URL, but only the one who plays a role of MODERATOR or an application who has created the conference can actually used it for downloading the recording file.

isRecording() → {Boolean}

Checks whether the conference is at the moment being recorded or not.

Returns:

The boolean value which indicates if the conference is at the moment being recorded or not

Type
Boolean

join(token) → {Promise.<Me>}

Joins the conference on behalf of a participant with a given token. The joining is asynchronous operation which assumes establishing a WebSocket connection with the server and loading the current conference state. The method returns a Promise that either resolves to a Me (if joining succeed) or rejects with an Error (if joining failed). Any failure of the WebSocket connection that happened after the Promise had been resolved, would be recovered automatically, so that the Me will stay online till we exit explicitly or till user close the browser tab.

Parameters:
Name Type Description
token String

The token of the participant on behalf of whom we are joining the conference

Returns:

The promise that resolves to Me

Type
Promise.<Me>

sendMessage(message, participantnullable)

Sends a message either to all remote participants in the conference, or to a single remote participant who was specified in a single argument.

Parameters:
Name Type Attributes Description
message String

The message that should be sent

participant Participant <nullable>

The remote participant who should receive a message.

setName(name) → {Promise}

Changes the name of the conference. Only a MODERATOR can change the name of the conference. This is an asynchronous operation, that's why this method returns a Promise that resolves when the name changing is completed.

Parameters:
Name Type Description
name String

The new name for the conference

Returns:

The promise that resolves when the renaming is completed

Type
Promise

startRecording() → {Promise}

Starts recording of the conference into a media file on the server. Only a participant who plays a role of MODERATOR or an application who has created the conference can start the recording. The method is asynchronous and returns a Promise that resolves when operation is completed.

Returns:

The promise that resolves when the operation is completed

Type
Promise

stopRecording() → {Promise}

Stops recording of the conference into a media file on the server. Only a participant who plays a role of MODERATOR or an application who has created the conference can stop the recording. The method is asynchronous and returns a Promise that resolves when operation is completed.

Returns:

The promise that resolves when the operation is completed

Type
Promise