Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/Meet/Room.vue
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Lines | export default { | ||||
initSession(init) { | initSession(init) { | ||||
this.post = { | this.post = { | ||||
password: this.password, | password: this.password, | ||||
nickname: this.nickname, | nickname: this.nickname, | ||||
screenShare: this.canShareScreen ? 1 : 0, | screenShare: this.canShareScreen ? 1 : 0, | ||||
init: init ? 1 : 0, | init: init ? 1 : 0, | ||||
picture: init ? this.makePicture() : '', | picture: init ? this.makePicture() : '', | ||||
requestId: this.requestId(), | requestId: this.requestId(), | ||||
role: this.camera || this.microphone ? 'PUBLISHER' : 'SUBSCRIBER' | canPublish: !!this.camera || !!this.microphone | ||||
} | } | ||||
$('#setup-password,#setup-nickname').removeClass('is-invalid') | $('#setup-password,#setup-nickname').removeClass('is-invalid') | ||||
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 | |||||
this.roomState = 'ready' | this.roomState = 'ready' | ||||
this.session = response.data | this.session = response.data | ||||
if (init) { | if (init) { | ||||
this.joinSession() | this.joinSession() | ||||
} | } | ||||
}) | }) | ||||
.catch(error => { | .catch(error => { | ||||
if (!error.response) { | |||||
console.error(error) | |||||
return | |||||
} | |||||
const data = error.response.data || {} | const data = error.response.data || {} | ||||
if (data.code) { | if (data.code) { | ||||
this.roomState = data.code | this.roomState = data.code | ||||
} else { | } else { | ||||
this.roomState = error.response.status | this.roomState = error.response.status | ||||
} | } | ||||
Show All 30 Lines | export default { | ||||
} | } | ||||
}) | }) | ||||
if (document.fullscreenEnabled) { | if (document.fullscreenEnabled) { | ||||
$('#meet-session-menu').find('.link-fullscreen.closed').removeClass('hidden') | $('#meet-session-menu').find('.link-fullscreen.closed').removeClass('hidden') | ||||
} | } | ||||
}, | }, | ||||
isPublisher() { | isPublisher() { | ||||
return this.session && this.session.role && this.session.role != 'SUBSCRIBER' | return this.session && this.session.canPublish | ||||
}, | }, | ||||
isRoomReady() { | isRoomReady() { | ||||
return ['ready', 322, 324, 325, 326, 327].includes(this.roomState) | return ['ready', 322, 324, 325, 326, 327].includes(this.roomState) | ||||
}, | }, | ||||
// An event received by the room owner when a participant is asking for a permission to join the room | // An event received by the room owner when a participant is asking for a permission to join the room | ||||
joinRequest(data) { | joinRequest(data) { | ||||
// The toast for this user request already exists, ignore | // The toast for this user request already exists, ignore | ||||
// It's not really needed as we do this on server-side already | // It's not really needed as we do this on server-side already | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |