Changeset View
Changeset View
Standalone View
Standalone View
src/resources/js/meet/app.js
Show First 20 Lines • Show All 158 Lines • ▼ Show 20 Lines | function joinRoom(data) { | ||||
// we got from our database. | // we got from our database. | ||||
if (sessionData.connections && connId in sessionData.connections) { | if (sessionData.connections && connId in sessionData.connections) { | ||||
Object.assign(metadata, sessionData.connections[connId]) | Object.assign(metadata, sessionData.connections[connId]) | ||||
} | } | ||||
metadata.element = participantCreate(metadata) | metadata.element = participantCreate(metadata) | ||||
connections[connId] = metadata | connections[connId] = metadata | ||||
// Send the current user status to the connecting user | |||||
// otherwise e.g. nickname might be not up to date | |||||
signalUserUpdate(event.connection) | |||||
}) | }) | ||||
session.on('connectionDestroyed', event => { | session.on('connectionDestroyed', event => { | ||||
let connectionId = event.connection.connectionId | let connectionId = event.connection.connectionId | ||||
let conn = connections[connectionId] | let conn = connections[connectionId] | ||||
if (conn) { | if (conn) { | ||||
// Remove elements related to the participant | // Remove elements related to the participant | ||||
Show All 28 Lines | function joinRoom(data) { | ||||
tabindex: -1 | tabindex: -1 | ||||
}) | }) | ||||
resize() | resize() | ||||
}) | }) | ||||
// Update the wrapper controls/status | // Update the wrapper controls/status | ||||
participantUpdate(metadata.element, metadata) | participantUpdate(metadata.element, metadata) | ||||
// Send the current user status to the connecting user | |||||
// otherwise e.g. nickname might be not up to date | |||||
signalUserUpdate(event.stream.connection) | |||||
}) | }) | ||||
// Stream properties changes e.g. audio/video muted/unmuted | // Stream properties changes e.g. audio/video muted/unmuted | ||||
session.on('streamPropertyChanged', event => { | session.on('streamPropertyChanged', event => { | ||||
let connectionId = event.stream.connection.connectionId | let connectionId = event.stream.connection.connectionId | ||||
let metadata = connections[connectionId] | let metadata = connections[connectionId] | ||||
if (session.connection.connectionId == connectionId) { | if (session.connection.connectionId == connectionId) { | ||||
▲ Show 20 Lines • Show All 495 Lines • ▼ Show 20 Lines | function signalUserUpdate(connection) { | ||||
let data = { | let data = { | ||||
nickname: sessionData.params.nickname | nickname: sessionData.params.nickname | ||||
} | } | ||||
session.signal({ | session.signal({ | ||||
data: JSON.stringify(data), | data: JSON.stringify(data), | ||||
type: 'userChanged', | type: 'userChanged', | ||||
to: connection ? [connection] : undefined | to: connection ? [connection] : undefined | ||||
}) | }).catch(err => { console.error(err) }); | ||||
// The same nickname for screen sharing session | // The same nickname for screen sharing session | ||||
if (screenSession) { | if (screenSession) { | ||||
screenSession.signal({ | screenSession.signal({ | ||||
data: JSON.stringify(data), | data: JSON.stringify(data), | ||||
type: 'userChanged', | type: 'userChanged', | ||||
to: connection ? [connection] : undefined | to: connection ? [connection] : undefined | ||||
}) | }).catch(err => { console.error(err) }); | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
* Switch interpreted language channel | * Switch interpreted language channel | ||||
* | * | ||||
* @param channel Two-letter language code | * @param channel Two-letter language code | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 936 Lines • Show Last 20 Lines |