Home Manual Reference Source
public class | source

Room

Room information

Member Summary

Public Members
public

Additional room informations

public

The local stream of the room

public

The room name

public

The room owner uid

public

The room status:

  • OPENED
  • CLOSED
public

The room unique id

Method Summary

Public Methods
public

Leaves & close the Room.

public

getLocalVideo(type: string, localStreamContainer: Element, constraints: MediaStreamConstraints): Promise<Local, Error>

get a local stream in video tag

public

invite(users: User[], role: string, message: string): Promise<{room: Room, invites: Invite[]}, Error>

Invite users to the room.

public

Join the room.

public

Leave the room.

public

Get the list of locally published streams.

public

Get the list of messages.

public

on(event: string, callback: function, cancelCallback: Webcom/api.Query~cancelCallback)

Register a callback for a specific event

public

Get the list of participants.

public

publish a local stream

public

Get the list of remotely published streams.

public

Send an instant message

public

share(type: string, localStreamContainer: Element, constraints: MediaStreamConstraints): Promise<Local, Error>

Publish a local stream

Public Members

public extra: Object source

Additional room informations

public localStream: Local source

The local stream of the room

public name: string source

The room name

public owner: string source

The room owner uid

public status: string source

The room status:

  • OPENED
  • CLOSED

public uid: string source

The room unique id

Public Methods

public close(): Promise source

Leaves & close the Room. Only the owner/moderator can close a room.

Return:

Promise

public getLocalVideo(type: string, localStreamContainer: Element, constraints: MediaStreamConstraints): Promise<Local, Error> source

get a local stream in video tag

Params:

NameTypeAttributeDescription
type string

The stream type, see StreamTypes for possible values

localStreamContainer Element
  • optional

The element the stream is attached to. Can be null if already specified in Config.

constraints MediaStreamConstraints
  • optional

The stream constraints. If not defined, the constraints defined in Config will be used.

Return:

Promise<Local, Error>

public invite(users: User[], role: string, message: string): Promise<{room: Room, invites: Invite[]}, Error> source

Invite users to the room. This will only work if the current User is the owner or a moderator of this Room. This will create the invitation and add the user to the participants list.

Params:

NameTypeAttributeDescription
users User[]

the users to invite

role string
  • optional
  • default: 'NONE'

the role of the invitee

message string
  • optional

a message to add to the invite

Return:

Promise<{room: Room, invites: Invite[]}, Error>

public join(): Promise source

Join the room. Sets the connected status of the current participant to CONNECTED.

Return:

Promise

public leave(): Promise source

Leave the room. Sets the connected status of the current participant to WAS_CONNECTED, deletes medias and callbacks, closes WebRTC stacks in use.

Return:

Promise

public localStreams(): Promise<Local[], Error> source

Get the list of locally published streams. The streams published with another device won't be visible here This will only work if the user is either a participant or the owner of the room.

Return:

Promise<Local[], Error>

public messages(): Promise<Message[], Error> source

Get the list of messages. This will only work if the user is either a participant or the owner of the room.

Return:

Promise<Message[], Error>

public on(event: string, callback: function, cancelCallback: Webcom/api.Query~cancelCallback) source

Register a callback for a specific event

Params:

NameTypeAttributeDescription
event string

The event name (Events/Room):

  • PARTICIPANT_ADDED: a participant is added to the room
  • PARTICIPANT_CHANGED: a participant changes his status (join)
  • PARTICIPANT_REMOVED: a participant leave the room
  • MESSAGE_ADDED: new instant message
  • MESSAGE_CHANGED: an existing message has been modified (moderation)
  • MESSAGE_REMOVED: a message has been removed (moderation)
  • STREAM_PUBLISHED: a participant published a new Stream
  • STREAM_CHANGED: a participant changes his published Stream (moderation, type, mute...)
  • STREAM_UNPUBLISHED: a participant stops the publication of his Stream
callback function

The callback for the event, the arguments depends on the type of event:

  • PARTICIPANT_* : callback(Participant p [, Error e])
  • MESSAGE_* : callback(Message m [, Error e])
  • STREAM_* : callback(Remote s [, Error e])
cancelCallback Webcom/api.Query~cancelCallback

The error callback for the event, takes an Error as only argument

public participants(): Promise<Participant[], Error> source

Get the list of participants. This will only work if the user is either a participant or the owner of the room.

Return:

Promise<Participant[], Error>

public publish(): Local source

publish a local stream

Return:

Local

public remoteStreams(): Promise<Remote[], Error> source

Get the list of remotely published streams. This will only work if the user is either a participant or the owner of the room.

Return:

Promise<Remote[], Error>

public sendMessage(message: string): Promise<Message> source

Send an instant message

Params:

NameTypeAttributeDescription
message string

The message to send

Return:

Promise<Message>

public share(type: string, localStreamContainer: Element, constraints: MediaStreamConstraints): Promise<Local, Error> source

Publish a local stream

Params:

NameTypeAttributeDescription
type string

The stream type, see StreamTypes for possible values

localStreamContainer Element
  • optional

The element the stream is attached to. Can be null if already specified in Config.

constraints MediaStreamConstraints
  • optional

The stream constraints. If not defined, the constraints defined in Config will be used.

Return:

Promise<Local, Error>