Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Meet/Room.vue
Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | export default { | ||||
break; | break; | ||||
} | } | ||||
}) | }) | ||||
if (document.fullscreenEnabled) { | if (document.fullscreenEnabled) { | ||||
$('#meet-session-menu').find('.link-fullscreen.closed').removeClass('hidden') | $('#meet-session-menu').find('.link-fullscreen.closed').removeClass('hidden') | ||||
} | } | ||||
}, | }, | ||||
isModerator() { | |||||
return this.isRoomOwner() || (!!this.session.role && (this.session.role & Roles.MODERATOR) > 0) | |||||
}, | |||||
isPublisher() { | isPublisher() { | ||||
return !!this.session.role && (this.session.role & Roles.PUBLISHER) > 0 | return !!this.session.role && (this.session.role & Roles.PUBLISHER) > 0 | ||||
}, | }, | ||||
isRoomOwner() { | isRoomOwner() { | ||||
return !!this.session.role && (this.session.role & Roles.OWNER) > 0 | return !!this.session.role && (this.session.role & Roles.OWNER) > 0 | ||||
}, | }, | ||||
isRoomReady() { | isRoomReady() { | ||||
return ['ready', 322, 324, 325, 326, 327].includes(this.roomState) | return ['ready', 322, 324, 325, 326, 327].includes(this.roomState) | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | export default { | ||||
$('#leave-dialog').on('hide.bs.modal', () => { | $('#leave-dialog').on('hide.bs.modal', () => { | ||||
// FIXME: Where exactly the user should land? Currently he'll land | // FIXME: Where exactly the user should land? Currently he'll land | ||||
// on dashboard (if he's logged in) or login form (if he's not). | // on dashboard (if he's logged in) or login form (if he's not). | ||||
this.$router.push({ name: 'dashboard' }) | this.$router.push({ name: 'dashboard' }) | ||||
}).modal() | }).modal() | ||||
} | } | ||||
} | } | ||||
this.session.onDismiss = connId => { this.dismissParticipant(connId) } | this.session.onDismiss = connId => { this.dismissParticipant(connId) } | ||||
this.session.onSessionDataUpdate = data => { this.updateSession(data) } | |||||
if (this.isRoomOwner()) { | this.session.onConnectionChange = (connId, data) => { this.updateParticipant(connId, data) } | ||||
this.session.onJoinRequest = data => { this.joinRequest(data) } | this.session.onJoinRequest = data => { this.joinRequest(data) } | ||||
} | |||||
this.meet.joinRoom(this.session) | this.meet.joinRoom(this.session) | ||||
}, | }, | ||||
logout() { | logout() { | ||||
const logout = () => { | const logout = () => { | ||||
this.meet.leaveRoom() | this.meet.leaveRoom() | ||||
this.meet = null | this.meet = null | ||||
this.$router.push({ name: 'dashboard' }) | this.$router.push({ name: 'dashboard' }) | ||||
▲ Show 20 Lines • Show All 134 Lines • ▼ Show 20 Lines | export default { | ||||
this.meet.switchScreen(enabled => { | this.meet.switchScreen(enabled => { | ||||
this.setMenuItem('screen', enabled) | this.setMenuItem('screen', enabled) | ||||
// After one screen sharing session ended request a new token | // After one screen sharing session ended request a new token | ||||
// for the next screen sharing session | // for the next screen sharing session | ||||
if (!enabled) { | if (!enabled) { | ||||
// TODO: This might need to be a different route. E.g. the room password might have | // TODO: This might need to be a different route. E.g. the room password might have | ||||
// changed since user joined the session | // changed since user joined the session | ||||
// Also because it creates a redundant connection (token) | |||||
axios.post('/api/v4/openvidu/rooms/' + this.room, this.post, { ignoreErrors: true }) | axios.post('/api/v4/openvidu/rooms/' + this.room, this.post, { ignoreErrors: true }) | ||||
.then(response => { | .then(response => { | ||||
// Response data contains: session, token and shareToken | // Response data contains: session, token and shareToken | ||||
this.session.shareToken = response.data.token | this.session.shareToken = response.data.shareToken | ||||
this.meet.updateSession(this.session) | this.meet.updateSession(this.session) | ||||
}) | }) | ||||
} | } | ||||
}) | }) | ||||
}, | |||||
updateParticipant(connId, params) { | |||||
if (this.isModerator()) { | |||||
axios.put('/api/v4/openvidu/rooms/' + this.room + '/connections/' + connId, params) | |||||
} | |||||
}, | |||||
updateSession(data) { | |||||
let params = {} | |||||
if ('role' in data) { | |||||
params.role = data.role | |||||
} | |||||
// merge new params into the object | |||||
this.session = Object.assign({}, this.session, params) | |||||
// update some buttons state e.g. when switching from publisher to subscriber | |||||
if (!this.isPublisher()) { | |||||
this.setMenuItem('audio', false) | |||||
this.setMenuItem('video', false) | |||||
} else { | |||||
if ('videoActive' in data) { | |||||
this.setMenuItem('video', data.videoActive) | |||||
} | |||||
if ('audioActive' in data) { | |||||
this.setMenuItem('audio', data.audioActive) | |||||
} | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
</script> | </script> |