Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
Connect meet low level to the jitsi provider
Browse files Browse the repository at this point in the history
  • Loading branch information
alimtunc committed Jul 5, 2023
1 parent a2beb61 commit 182e1e0
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 52 deletions.
112 changes: 60 additions & 52 deletions core/modules/meet/client/meet-low-level.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,53 +228,59 @@ const onUserPropertyUpdated = async (e, template) => {
** LowMeetJs
*/

const DOMAIN = '8x8.vc'
const getOptions = () => ({
// Connection
hosts: {
domain: DOMAIN,
muc: `conference.${DOMAIN}`,
focus: `focus.${DOMAIN}`,
},
serviceUrl: `wss://${DOMAIN}/xmpp-websocket?room=${meetLowLevel.roomName}`,
websocketKeepAliveUrl: `https://${DOMAIN}/_unlock?room=${meetLowLevel.roomName}`,
const getOptions = () => {
const serverURL = Meteor.settings.public.meet.serverURL

if (!serverURL) return
const [domain, sub] = serverURL.split('/')

return {
// Connection
hosts: {
domain: serverURL,
muc: `conference.${sub}.${domain}`,
focus: `focus.${domain}`,
},
serviceUrl: `wss://${serverURL}/xmpp-websocket?room=${meetLowLevel.roomName}`,
websocketKeepAliveUrl: `https://${serverURL}/_unlock?room=${meetLowLevel.roomName}`,

// Enable Peer-to-Peer for 1-1 calls
p2p: {
enabled: false,
},
// Enable Peer-to-Peer for 1-1 calls
p2p: {
enabled: false,
},

// Video quality / constraints
constraints: {
video: {
height: {
ideal: 720,
max: 720,
min: 180,
},
width: {
ideal: 1280,
max: 1280,
min: 320,
// Video quality / constraints
constraints: {
video: {
height: {
ideal: 720,
max: 720,
min: 180,
},
width: {
ideal: 1280,
max: 1280,
min: 320,
},
},
},
},
channelLastN: 25,
channelLastN: 25,

// Logging
logging: {
// Default log level
defaultLogLevel: 'trace',
// Logging
logging: {
// Default log level
defaultLogLevel: 'trace',

// The following are too verbose in their logging with the default level
'modules/RTC/TraceablePeerConnection.js': 'info',
'modules/statistics/CallStats.js': 'info',
'modules/xmpp/strophe.util.js': 'log',
},
// The following are too verbose in their logging with the default level
'modules/RTC/TraceablePeerConnection.js': 'info',
'modules/statistics/CallStats.js': 'info',
'modules/xmpp/strophe.util.js': 'log',
},

// End marker, disregard
__end: true,
})
// End marker, disregard
__end: true,
}
}

export const meetLowLevel = {
connectionStarted: false,
Expand Down Expand Up @@ -305,20 +311,22 @@ export const meetLowLevel = {
})
.catch((err) => console.error('An error occured while creating local tracks', err))

const connection = new jitsiMeetJS.JitsiConnection(null, null, options)
Meteor.call('computeRoomToken', this.roomName, (err, token) => {
const connection = new jitsiMeetJS.JitsiConnection(null, token, options)

connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, () => {
this.onConnectionSuccess()
})
connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_FAILED, () => {
this.onConnectionFailed()
})
connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, () => {
this.onConnectionDisconnected()
})
connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_ESTABLISHED, () => {
this.onConnectionSuccess()
})
connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_FAILED, () => {
this.onConnectionFailed()
})
connection.addEventListener(jitsiMeetJS.events.connection.CONNECTION_DISCONNECTED, () => {
this.onConnectionDisconnected()
})

connection.connect()
this.template.connection.set(connection)
connection.connect()
this.template.connection.set(connection)
})
}
},

Expand Down
15 changes: 15 additions & 0 deletions core/modules/meet/server/meet.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ const updateUserRoomName = (roomName) => {
}

Meteor.methods({
computeRoomToken(roomName) {
check(roomName, Match.Maybe(String))
const user = Meteor.user()
if (!user) return

log('computeRoomToken: start', { roomName })
const token = computeRoomToken(user, roomName)
log('computeRoomToken: end', { roomName })

return token
},

// Meet conference
computeMeetRoomAccess(zoneId) {
if (!this.userId) return undefined
check(zoneId, Match.Id)
Expand All @@ -79,6 +92,8 @@ Meteor.methods({

return { roomName, token }
},

// Meet low level
updateUserRoomName(roomName) {
check(roomName, Match.Maybe(String))
const user = Meteor.user()
Expand Down

0 comments on commit 182e1e0

Please sign in to comment.