2020 API AWARDS WINNER - BEST IN MEDIA APIs LEARN MORE

ConferenceService

The ConferenceService allows the application to manage the conference life-cycle and interact with the conference.

The ConferenceService introduces APIs that allow the application to:

  • Create a conference
  • Invite participants to a conference
  • Fetch the Conference object required to join a conference
  • Join a conference with permission to share media or as a listener
  • Configure the quality of the received Simulcast streams
  • Create a demo conference and join it
  • Start and stop audio transmission
  • Start and stop video transmission
  • Start and stop sharing the screen
  • Control the mute state of the conference participants
  • Check the audio level of a specific participant
  • Get the participants' list
  • Get the speaking status of a selected participant
  • Check the WebRTC statistics
  • Leave the conference
  • Replay the previously recorded conference

The ConferenceService introduces events that inform the application that:

  • The participant has joined a conference or has left it
  • A connected participant joins a conference using another device and the same ExternalId
  • A conference participant has joined a conference or changed status
  • A stream is added, changed, or removed
  • The replayed conference has ended
  • An error has occurred

Additionally, every 5 seconds the application emits the qualityIndicators event to inform about Mean Opinion Scores (MOS) for audio and video.


Events

ended

ended(): void

Emitted when the replayed conference has ended.

example

VoxeetSDK.conference.on("ended", () => {})

Returns: void


error

error(): void

Emitted when an error has occurred.

example

VoxeetSDK.conference.on("error", () => {})

Returns: void


joined

joined(): void

Emitted when the application has successfully joined the conference.

example

VoxeetSDK.conference.on("joined", () => {})

Returns: void


left

left(): void

Emitted when the application has left the conference.

example

VoxeetSDK.conference.on("left", () => {})

Returns: void


participantAdded

participantAdded(participant: Participant): void

Emitted when a participant is added to the conference.

example

VoxeetSDK.conference.on("participantAdded", user => {})

Parameters:

NameType
participantParticipant

Returns: void


participantUpdated

participantUpdated(participant: Participant): void

Emitted when a participant is updated. For more information, check the ParticipantStatus model.

example

VoxeetSDK.conference.on("participantUpdated", participant => {})

Parameters:

NameType
participantParticipant

Returns: void


qualityIndicators

qualityIndicators(indicators: Map‹string, QualityIndicator›): void

Emitted every 5 seconds to inform about Mean Opinion Scores (MOS) for audio and video.

Parameters:

NameTypeDescription
indicatorsMap‹string, QualityIndicatorA map of quality indicators per participantId

Returns: void


streamAdded

streamAdded(participant: Participant, stream: MediaStreamWithType): void

Emitted in the following situations:

  • A conference participant with an enabled microphone joins a conference.
  • A conference participant starts sharing a screen.

example

VoxeetSDK.conference.on("streamAdded", (participant, stream) => {
  node = document.getElementById("received_video")
  navigator.attachMediaStream(node, stream)
})

Parameters:

NameType
participantParticipant
streamMediaStreamWithType

Returns: void


streamRemoved

streamRemoved(participant: Participant, stream: MediaStreamWithType): void

Emitted in the following situations:

  • A conference participant stops sharing a screen.
  • A conference participant leaves a conference.

example

VoxeetSDK.conference.on("streamRemoved", (participant, stream) => {})

Parameters:

NameType
participantParticipant
streamMediaStreamWithType

Returns: void


streamUpdated

streamUpdated(participant: Participant, stream: MediaStreamWithType): void

Emitted after a video stream update. This event occurs when a participant changes the video track by switching a camera. When the application receives the streamUpdated event, it attaches the stream to the <video> element.

example

VoxeetSDK.conference.on("streamUpdated", (participant, stream) => {
  node = document.getElementById("received_video")
  navigator.attachMediaStream(node, stream)
})

Parameters:

NameType
participantParticipant
streamMediaStreamWithType

Returns: void


switched

switched(): void

Emitted when a new participant joins a conference using the same external ID as another participant who has joined this conference earlier. This event may occur when a participant joins the same conference using another browser or device. In such a situation, the SDK removes the participant who has joined the conference earlier.

Returns: void

Accessors

current

get current(): Conference | null

Returns the current conference.

Returns: Conference | null


participants

get participants(): Map‹string, Participant

Provides a list of conference participants.

Returns: Map‹string, Participant

Methods

audioLevel

audioLevel(Participant: Participant, callback: Function): any

Gets the participant's audio level. The possible values of the audio level are in range from 0.0 to 1.0 point.

Parameters:

NameTypeDescription
ParticipantParticipant-
callbackFunctionThe callback to retrieve the audio level

Returns: any


create

create(options: ConferenceOptions): Promise‹Conference

Creates a conference with ConferenceOptions.

Parameters:

NameType
optionsConferenceOptions

Returns: Promise‹Conference


demo

demo(): Promise‹Conference‹››

Creates and joins a demo conference.

Returns: Promise‹Conference‹››


fetch

fetch(conferenceId: string): Promise‹Conference

Provides a Conference object that allows joining a conference.

Parameters:

NameType
conferenceIdstring

Returns: Promise‹Conference


invite

invite(conference: Conference, participants: Array‹ParticipantInfo›): Promise‹any›

Sends the notifications to the conference participants to inform them about the invitation to the conference. The use of [externalId](/developers interactivity-apis/client-sdk/reference-javascript/model/participantinfo#optional-externalid) from the ParticipantInfo model is mandatory.

Note: Use the invite method only after joining a conference. For more information about using invitations, see the Using Invitations article.

VoxeetSDK.conference.invite((conference: Conference), (externalId: externalId))

Parameters:

NameTypeDescription
conferenceConference-
participantsArray‹ParticipantInfo

Returns: Promise‹any›


isSpeaking

isSpeaking(participant: Participant, callback: Function): any

Gets the participant's current speaking status for an active talker indicator.

Parameters:

NameTypeDescription
participantParticipant-
callbackFunctionThe callback to retrieve the status

Returns: any


join

join(conference: Conference, options: JoinOptions): Promise‹Conference

Joins the conference.

See also: listen, replay

example

// For example
const constraints = {
  audio: true,
  video: {
    width: {
      min: "320",
      max: "1280",
    },
    height: {
      min: "240",
      max: "720",
    },
  },
}

// A simplest example of constraints would be:
const constraints = { audio: true, video: true }

VoxeetSDK.conference
  .join(conference, { constraints: constraints })
  .then(info => {})
  .catch(error => {})

Parameters:

NameTypeDescription
conferenceConferenceThe conference to be joined
optionsJoinOptionsOptions for the conference

Returns: Promise‹Conference


leave

leave(leaveRoom: boolean): Promise‹void›

Leaves the conference.

Parameters:

NameTypeDefaultDescription
leaveRoombooleantrue

Returns: Promise‹void›


listen

listen(conference: Conference): Promise‹Conference‹››

Joins a conference as a listener. You can choose to either join, replay, or listen to a conference. The listen method connects to the conference in the receiving only mode which does not allow transmitting video or audio.

See also: join, replay

Parameters:

NameType
conferenceConference

Returns: Promise‹Conference‹››


localStats

localStats(): WebRTCStats

Provides standard WebRTC statistics for the application. Based on the WebRTC statistics, the SDK computes audio and video statistics.

Returns: WebRTCStats


mute

mute(participant: Participant, isMuted: boolean): any

Controls the mute state of the participant.

Parameters:

NameTypeDescription
participantParticipantWhich participant to set mute on/off
isMutedbooleanMute On/Off

Returns: any


replay

replay(conference: Conference, offset: number, mixingOptions?: MixingOptions): Promise‹Conference

Replays a previously recorded conference.

See also: join, listen

Parameters:

NameTypeDefaultDescription
conferenceConference--
offsetnumber0Replays the conference from this offset (in milliseconds)
mixingOptions?MixingOptions--

Returns: Promise‹Conference


simulcast

simulcast(requested: Array‹ParticipantQuality›): any

Configures the quality of the received Simulcast streams.

Parameters:

NameTypeDescription
requestedArray‹ParticipantQualityan array of quality per participant.

Returns: any


startAudio

startAudio(participant: Participant): Promise‹any›

Starts the audio transmission for a specific participant. This method allows the application to start transmitting audio for local and remote participants.

The Voxeet SDK automatically manages audio rendering, and therefore, the application does not need to implement its own <audio> element. The application can use selectAudioInput and selectAudioOutput methods to select the proper audio input and output devices.

Parameters:

NameTypeDescription
participantParticipantA participant to which the audio stream will be started

Returns: Promise‹any›


startScreenShare

startScreenShare(): any

Starts a screen sharing session.

example

VoxeetSDK.conference
  .startScreenShare()
  .then(() => {})
  .catch(e => {})

Returns: any


startVideo

startVideo(participant: Participant, constraints: any): Promise‹any›

Starts the video stream for a participant, which can be either a remote participant or a local participant that belongs to the current session.

For remote participants, this method informs the Voxeet service to forward the remote participant's video to the application. If this operation is successful, it results in emitting the streamAdded event. If the remote participant has not started sending a video yet, then the returned promise contains an error.

For local participants, this method triggers the application to start sending video to the Voxeet service. It is possible to start sending a video while joining.

example

const video = {
  mandatory: {
    minWidth: 160,
    minHeight: 120,
    maxWidth: 320,
    maxHeight: 240,
    minFrameRate: 10,
    maxFrameRate: 30,
  },
}

voxeet.conference.startVideo(participantId, constraints).then(() => {})

Parameters:

NameTypeDescription
participantParticipantA participant to which the video will be started, either remote or local.
constraintsanyWebRTC video contraints

Returns: Promise‹any›


stopAudio

stopAudio(participant: Participant): Promise‹any›

Stops the audio stream for the participant.

Parameters:

NameType
participantParticipant

Returns: Promise‹any›


stopScreenShare

stopScreenShare(): Promise‹any›

Stops the screen-sharing session.

Returns: Promise‹any›


stopVideo

stopVideo(participant: Participant): Promise‹any›

Stops the video stream for the participant.

Parameters:

NameType
participantParticipant

Returns: Promise‹any›