Class: videoRoom

videoRoom

VideoRoom usecase


new videoRoom(onEvents, domElements, options)

VideoRoom usecase

Parameters:
Name Type Description
onEvents object

Event handlers: onEvents

domElements object

DOM elements: domElements

options object

Available options: options

Returns:

VideoRoom actions

Type
Promise
Example
var onEvents = {
    onCreated: id => {
         // Videoroom ID created
    },
    onError: (cause, code) => {
         // An error has occurred
    },
    onJoined: () => {
         // You've joined the Videoroom
    },
    onDestroyed: () => {
         // Videoroom ID destroyed
    },
    onPeerJoined: (id, display) => {
         // A new peer has joined the videoroom
    },
    onPeerLeft: (id, display) => {
         // A new peer has left the videoroom
    }
};

var domElements = {
    videos: document.getElementById('videortc-videos') // App container
};

var options = {
    stream: {
        audioEnabled: true,
        videoEnabled: true,
        aDeviceId: null,
        vDeviceId: null,
         resolution: 'vga' // 'qvga', 'vga', 'hd', 'full-hd', '4k', '8k'
        voiceProcessor: false
    },
    account: "******" // Multiple mode
};

usecases.videoRoom(onEvents, domElements, options)
    .then(action => {
         // Use Case has been atacched succesfully
         ...
    })
    .catch(cause => {
        // Error attaching the Use Case
        Janus.error("Error Attach " + cause );
    })

Methods


<inner> closeUsecase()

Close the current UseCase. It's recommended combine with disconnect method

Returns:
Type
nothing
Example
action.closeUsecase();
myVideoApp.disconnect(); // Recommended

<inner> createVideoroom(isPrivate, adminKey, userKey, quality, maxPublishers, isRecord)

Creates a new VideoRoom / Conference

Parameters:
Name Type Description
isPrivate Boolean

Is private?

adminKey string

Administrator Room Key (Destroy)

userKey string

User Room Key (Join)

quality string | enum

Quality: "high", "medium" or "low"

maxPublishers integer

Number of publishers/peers

isRecord Boolean

Record the videoroom

Returns:
Type
nothing
Example
action.createVideoroom(true, 'MyP455w0rd', 'Us3rPw', 'medium', 6, false);

<inner> destroyVideoroom(id, adminKey)

Destroys a Videoroom (Admin key is required)

Parameters:
Name Type Description
id integer

VideoRoom Id

adminKey string

Administrator Room Key

Returns:
Type
nothing
Example
action.destroyVideoroom(743267423, 'MyP455w0rd');

<inner> getPeers()

Gets the number of peers/users connected into the current Videoroom

Returns:

Number of peers/users connected into the current Videoroom

Type
integer
Example
action.getPeers(); // Number of peers

<inner> joinVideoroom(name, idRoom, pin)

Join into a VideoRoom

Parameters:
Name Type Description
name string

User Name

idRoom integer

VideoRoom ID

pin string

Videoroom PIN to Join (Optional)

Returns:
Type
nothing
Example
action.joinVideoroom('Mike', 743267423, 'ivr1234');

<inner> toggleAudio()

Toggle Audio stream (Mute/Unmute)

Returns:

Is audio muted?

Type
boolean
Example
action.toggleAudio(); // true or false

<inner> toggleVideo()

Toggle Video stream (Mute/Unmute)

Returns:

Is video muted?

Type
boolean
Example
action.toggleVideo(); // true or false