Blame view
src/pages/Dashboard/LiveOnlineClass.vue
13.8 KB
ac24ec07a
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
<template> <div class="body-color"> <!-- LOADER --> <div class="loader" v-if="showLoader"> <v-progress-circular indeterminate color="white"></v-progress-circular> </div> <!-- SNACKBAR --> <v-snackbar :timeout="timeout" :top="y === 'top'" :right="x === 'right'" :vertical="mode === 'vertical'" v-model="snackbar" :color="snackbarColor" > {{ text }} <v-spacer></v-spacer> <v-btn flat text @click="snackbar = false">X</v-btn> </v-snackbar> |
ac24ec07a
|
21 22 |
<v-container grid-list-xl class="pt-0"> <v-layout row wrap class="mt-1"> |
e91641fe5
|
23 |
<!-- if logged in user is parent --> |
30e404e65
|
24 25 26 27 |
<v-flex xs12 sm12 md9 v-if=" $store.state.role === 'PARENT' "> <v-layout column> <!-- HEADING --> <v-flex> |
e91641fe5
|
28 29 30 |
<div class="title side-bar-color font-weight-bold" >Live Online Classes - {{$route.query.chapterName}}</div> |
9a4a64725
|
31 |
<!-- <div class="subheading grey--text lighten-1">{{liveLink}}</div> --> |
edfe025fa
|
32 |
<!-- <div |
30e404e65
|
33 |
class="subheading grey--text lighten-1" |
852713654
|
34 |
>The session started at 1:00 there is 1 moderator</div>--> |
30e404e65
|
35 36 37 |
</v-flex> <!-- JOIN OR END SESSION --> |
46997790d
|
38 |
<v-flex v-if="showJoinSessionButton"> |
30e404e65
|
39 |
<div> |
edfe025fa
|
40 41 42 43 44 |
<v-btn round class="open-dialog-button" dark v-if="studentBtn" |
d23a27a41
|
45 |
@click="showLoader = true;startChat();" |
edfe025fa
|
46 |
>{{studentBtn}}</v-btn> |
852713654
|
47 |
<span class="subheading grey--twxt lighten-1" v-else>Session hasnt started yet</span> |
30e404e65
|
48 49 |
</div> </v-flex> |
375b62cd1
|
50 |
<v-flex id="studentClone"> |
edfe025fa
|
51 52 |
<div id="jitsi-container"></div> </v-flex> |
30e404e65
|
53 54 |
</v-layout> </v-flex> |
e91641fe5
|
55 56 |
<!-- if logged in user is teacher --> |
30e404e65
|
57 |
<v-flex xs12 sm12 md12 v-else> |
ac24ec07a
|
58 59 60 |
<v-layout column> <!-- HEADING --> <v-flex> |
cf2d498a8
|
61 62 63 |
<div class="title side-bar-color font-weight-bold" >Live Online Classes - {{$route.query.chapterName}}</div> |
852713654
|
64 65 |
<!-- <div class="subheading grey--text lighten-1"></div> --> <!-- <div |
ac24ec07a
|
66 |
class="subheading grey--text lighten-1" |
852713654
|
67 |
>The session started at 1:00 there is 1 moderator</div>--> |
ac24ec07a
|
68 69 70 |
</v-flex> <!-- JOIN OR END SESSION --> |
92c6232a6
|
71 |
<v-flex v-if="showStartSessionButton"> |
ac24ec07a
|
72 |
<div> |
860da881d
|
73 74 75 76 77 78 |
<v-btn round class="open-dialog-button" dark @click="showLoader = true;startChat()" >Start Session</v-btn> |
ac24ec07a
|
79 80 |
</div> </v-flex> |
375b62cd1
|
81 |
<v-flex id="teacherClone"> |
e91641fe5
|
82 |
<div id="jitsi-container"></div> |
ac24ec07a
|
83 84 85 86 87 |
</v-flex> </v-layout> </v-flex> <v-spacer></v-spacer> |
e91641fe5
|
88 |
<!-- COURSES SIDE BAR- positioned to the right of the page --> |
de958fcfc
|
89 |
<!-- <v-flex xs3> |
ac24ec07a
|
90 |
<v-card class="elevation-0 card-border" height="100%"> |
e91641fe5
|
91 |
<CoursesSideBar></CoursesSideBar> |
ac24ec07a
|
92 |
</v-card> |
de958fcfc
|
93 |
</v-flex>--> |
ac24ec07a
|
94 95 96 97 98 99 100 101 |
</v-layout> </v-container> </div> </template> <script> import AllApiCalls from "@/Services/AllApiCalls.js"; import http from "@/Services/http.js"; import moment from "moment"; |
e91641fe5
|
102 103 |
import Meet from "@/pages/Meet/meet.vue"; import CoursesSideBar from "@/pages/Common/CoursesSideBar.vue"; |
ac24ec07a
|
104 105 |
export default { mixins: [AllApiCalls], |
e91641fe5
|
106 |
components: { |
375b62cd1
|
107 |
CoursesSideBar, |
e91641fe5
|
108 |
}, |
ac24ec07a
|
109 110 |
data() { return { |
e91641fe5
|
111 |
startLiveSession: "", |
852713654
|
112 |
studentBtn: "", |
ac24ec07a
|
113 114 115 116 |
// DATA TABLE search: "", pagination: { |
375b62cd1
|
117 |
rowsPerPage: 10, |
ac24ec07a
|
118 119 120 121 122 123 |
}, liveOnlineHeaders: [ { text: "Playback", value: "attachementUrl", sortable: false, |
375b62cd1
|
124 |
align: "center", |
ac24ec07a
|
125 126 127 128 129 |
}, { text: "Meeting", align: "center", sortable: false, |
375b62cd1
|
130 |
value: "", |
ac24ec07a
|
131 132 133 134 135 |
}, { text: "Recording", value: "", sortable: false, |
375b62cd1
|
136 |
align: "center", |
ac24ec07a
|
137 138 139 140 141 |
}, { text: "Description Preview", value: "", sortable: false, |
375b62cd1
|
142 |
align: "center", |
ac24ec07a
|
143 144 145 |
}, { text: "Date", value: "", sortable: false, align: "center" }, { text: "Duration", value: "", sortable: false, align: "center" }, |
375b62cd1
|
146 |
{ text: "Toolbar", value: "", sortable: false, align: "center" }, |
ac24ec07a
|
147 148 |
], liveOnlineItems: [], |
e91641fe5
|
149 |
// JITSI CONTAINER |
edfe025fa
|
150 |
liveLink: "", |
e91641fe5
|
151 152 |
token: "", selectStudents: {}, |
375b62cd1
|
153 154 |
classRules: [(v) => !!v || " Class Name is required"], sectionRules: [(v) => !!v || " Section Name is required"], |
e91641fe5
|
155 156 157 158 159 |
addclass: [], addSection: [], loading: false, room: "", username: "", |
375b62cd1
|
160 161 |
roomPassword: "", counter: 0, |
b6e4f6eaa
|
162 |
appLink: "", |
92c6232a6
|
163 |
showStartSessionButton: true, |
46997790d
|
164 |
showJoinSessionButton: true, |
ac24ec07a
|
165 166 167 |
}; }, methods: { |
6e1cb5c96
|
168 |
async startChat() { |
375b62cd1
|
169 |
if (this.$store.state.role === "PARENT") { |
d32525d71
|
170 171 172 173 174 175 176 177 178 179 |
// if (this.counter == 0) { // console.log("enter start chat"); const isMobile = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent); if (isMobile) { window.open(this.appLink); this.showLoader = false; } else { this.startConference(); // this.counter += 1; this.showJoinSessionButton = false; |
6e1cb5c96
|
180 |
} |
d32525d71
|
181 |
// } |
375b62cd1
|
182 183 |
} if (this.$store.state.role === "TEACHER") { |
d32525d71
|
184 185 186 187 |
// if (this.counter == 0) { this.createRoom(); // this.counter += 1; // } |
375b62cd1
|
188 189 |
} }, |
e91641fe5
|
190 191 |
// JITSI CONTAINER startConference() { |
860da881d
|
192 |
// console.log("yes session started"); |
e91641fe5
|
193 194 |
var _this = this; try { |
01a388dfe
|
195 |
const domain = "meet.intrack.in"; |
e91641fe5
|
196 197 198 199 |
const options = { audioInput: "<deviceLabel>", audioOutput: "<deviceLabel>", videoInput: "<deviceLabel>", |
edfe025fa
|
200 |
prejoinPageEnabled: false, |
e91641fe5
|
201 202 203 204 205 |
roomName: this.room, height: 500, parentNode: document.getElementById("jitsi-container"), interfaceConfigOverwrite: { filmStripOnly: false, |
9a4a64725
|
206 207 |
SHOW_PROMOTIONAL_CLOSE_PAGE: false, SHOW_POWERED_BY: false, |
e91641fe5
|
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
SHOW_JITSI_WATERMARK: false, TOOLBAR_BUTTONS: [ "microphone", "camera", "closedcaptions", "desktop", "fullscreen", "fodeviceselection", "hangup", "profile", "info", "chat", "recording", "livestreaming", "etherpad", "sharedvideo", "settings", "raisehand", "videoquality", "filmstrip", "invite", "feedback", "stats", "shortcuts", |
375b62cd1
|
232 233 |
"tileview", ], |
e91641fe5
|
234 235 |
}, configOverwrite: { |
375b62cd1
|
236 |
disableSimulcast: false, |
e91641fe5
|
237 238 |
}, teacherName: "", |
e05668b28
|
239 |
room: "", |
e91641fe5
|
240 |
}; |
a690a86fb
|
241 |
_this.api = new JitsiMeetExternalAPI(domain, options); |
860da881d
|
242 |
// console.log("this.api ", this.api); |
a690a86fb
|
243 |
_this.api.addEventListener("videoConferenceJoined", () => { |
90bec8782
|
244 |
this.showLoader = false; |
e05668b28
|
245 246 247 248 |
setTimeout(() => { _this.api.executeCommand("displayName", _this.username); _this.api.executeCommand("password", _this.roomPassword); }, 1000); |
ac24ec07a
|
249 |
}); |
860da881d
|
250 |
|
32eff55c5
|
251 252 253 |
_this.api.on("passwordRequired", () => { _this.api.executeCommand("password", _this.roomPassword); }); |
a690a86fb
|
254 |
_this.api.on("readyToClose", () => { |
92c6232a6
|
255 256 257 258 |
// this.$router.push({ name: "Refresh" }); let jitsi = document.getElementById("jitsi-container"); jitsi.innerHTML = ""; this.showStartSessionButton = true; |
46997790d
|
259 |
this.showJoinSessionButton = true; |
9a4a64725
|
260 |
}); |
e91641fe5
|
261 |
} catch (error) { |
860da881d
|
262 |
// console.error("Failed to load Jitsi API", error); |
ac24ec07a
|
263 264 |
} }, |
e91641fe5
|
265 266 267 268 269 270 271 272 273 274 275 |
openRoom() { // verify the JitsiMeetExternalAPI constructor is added to the global.. // if (this.teacherName != "" || this.room != "") { // if (window.JitsiMeetExternalAPI) { // // var person = prompt("Please enter your name:", "Rabie"); // if (person != null || person != "") this.username = this.teacherName; // var room = prompt("Please enter your room:", "Test Room"); // if (room != null || room != "") this.room = this.room; // this.startConference(); // } else alert("Jitsi Meet API script not loaded"); // } |
ac24ec07a
|
276 |
}, |
e91641fe5
|
277 |
createRoom(classId) { |
8b7976c3a
|
278 |
// this.showLoader = true; |
e91641fe5
|
279 |
var classId = { |
375b62cd1
|
280 |
classId: classId, |
ac24ec07a
|
281 282 |
}; http() |
e91641fe5
|
283 284 285 |
.post("/createLiveClasses", { classId: this.$route.query.classId, courseId: this.$route.query.courseId, |
375b62cd1
|
286 |
chapterId: this.$route.query.chapterId, |
ac24ec07a
|
287 |
}) |
375b62cd1
|
288 |
.then((response) => { |
e91641fe5
|
289 |
// this.addSection = response.data.data; |
860da881d
|
290 |
// console.log("CREATE___ROOOM", response.data); |
a690a86fb
|
291 |
var room = response.data.data.roomName; |
860da881d
|
292 |
var username = localStorage.getItem("teacherName"); |
a690a86fb
|
293 |
var roomPassword = response.data.data.password; |
b6e4f6eaa
|
294 |
this.appLink = response.data.data.appLink; |
860da881d
|
295 296 297 298 299 300 301 302 |
// console.log( // "room", // room, // "username", // username, // "roomPassword", // roomPassword // ); |
e91641fe5
|
303 |
var this_ = this; |
a690a86fb
|
304 |
if (username != "" || room != "") { |
b6e4f6eaa
|
305 306 307 308 309 310 |
const isMobile = /iPhone|iPad|iPod|Android/i.test( navigator.userAgent ); if (isMobile) { // console.log("==TEACHER=appLink==", this.appLink); window.open(this.appLink); |
92c6232a6
|
311 312 |
this.showLoader = false; this.showStartSessionButton = false; |
b6e4f6eaa
|
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 |
} else { if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); if (username != null || username != "") { this_.username = username; } // var room = prompt("Please enter your room:", "Test Room"); if (room != null || room != "") { this_.room = room; } if (roomPassword != null || roomPassword != "") { this_.roomPassword = roomPassword; } } else alert("Jitsi Meet API script not loaded"); this_.startConference(); |
92c6232a6
|
328 |
this.showStartSessionButton = false; |
b6e4f6eaa
|
329 |
} |
e91641fe5
|
330 |
} |
ac24ec07a
|
331 |
}) |
375b62cd1
|
332 |
.catch((err) => { |
ac24ec07a
|
333 334 |
this.showLoader = false; }); |
375b62cd1
|
335 336 |
}, async studentClasses() { |
fa975e45a
|
337 338 339 340 |
this.liveLink = ""; this.room = ""; this.username = ""; this.roomPassword = ""; |
375b62cd1
|
341 342 343 344 345 346 |
/* getLiveClassesesList - To up date line under heading*/ let response = await this.getLiveClassesesList({ classId: this.$route.query.classId, courseId: this.$route.query.courseId, chapterId: this.$route.query.chapterId, }); |
860da881d
|
347 |
// console.log("response getLiveClassesesList- ", response); |
852713654
|
348 |
|
375b62cd1
|
349 |
/* CHECK RESPONSE TO ASSIGN MESSAGE INSIDE BUTTON */ |
6e1cb5c96
|
350 351 352 353 354 355 356 357 |
if (response.data.data[0].sessionStatus == "ENDED") { // this.startLiveSession = "Start Session"; this.studentBtn = ""; } if (response.data.data[0].sessionStatus == "STARTED") { // this.startLiveSession = "Join Session"; this.studentBtn = "Join Session"; } |
375b62cd1
|
358 359 360 361 362 |
if (response.data.data.length == 0) { this.startLiveSession = "Start Session"; this.studentBtn = ""; } else { this.liveLink = response.data.data[0].link; |
b6e4f6eaa
|
363 |
this.appLink = response.data.data[0].appLink; |
fa975e45a
|
364 |
var room = response.data.data[0].roomName; |
a690a86fb
|
365 366 |
var username = this.currentUser; var roomPassword = response.data.data[0].password; |
375b62cd1
|
367 |
var this_ = this; |
a690a86fb
|
368 |
// console.log(this.room, this.roomPassword, this.username); |
edfe025fa
|
369 |
|
fa975e45a
|
370 |
if (username != "" || room != "") { |
375b62cd1
|
371 372 |
if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); |
fa975e45a
|
373 |
if (username != null || username != "") { |
a690a86fb
|
374 375 376 377 |
this_.username = username; } if (roomPassword != null || roomPassword != "") { this_.roomPassword = roomPassword; |
375b62cd1
|
378 379 |
} // var room = prompt("Please enter your room:", "Test Room"); |
fa975e45a
|
380 |
if (room != null || room != "") { |
a690a86fb
|
381 |
this_.room = room; |
375b62cd1
|
382 |
} |
6e1cb5c96
|
383 |
// this.startConference(); |
edfe025fa
|
384 |
} |
edfe025fa
|
385 |
} |
852713654
|
386 |
} |
375b62cd1
|
387 388 |
}, }, |
375b62cd1
|
389 |
async created() { |
860da881d
|
390 391 392 393 |
// console.log( // "this.$store.state.studentsData", // this.$store.state.studentsData[0].name // ); |
a690a86fb
|
394 |
this.currentUser = localStorage.getItem("studentName"); |
fa975e45a
|
395 |
this.token = this.$store.state.token; |
375b62cd1
|
396 |
if (this.$store.state.role === "PARENT") { |
6e1cb5c96
|
397 |
await this.studentClasses(); |
e91641fe5
|
398 399 400 401 402 403 |
} /* getStudentCourses - to get courseData - defined in GetApis.js*/ if (this.$store.state.role === "PARENT") { await this.getStudentCourses({ classId: localStorage.getItem("parentClassId"), |
375b62cd1
|
404 |
studentId: localStorage.getItem("parentStudentId"), |
e91641fe5
|
405 406 |
}); } |
375b62cd1
|
407 |
}, |
ac24ec07a
|
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
}; </script> <style scoped> .side-bar-color { color: #827bfa !important; /* border-top-right-radius: 74px !important; */ } .card-border { border: 1px #bdbdbd solid; border-radius: 3px; } .reply-desc { border: 1px solid #f2f2f2; } .open-dialog-button { background: #827bfa !important; border-color: #827bfa !important; text-transform: none !important; } .reply-btn { background: #feb83c !important; border-color: #feb83c !important; text-transform: none !important; -webkit-box-shadow: none !important; box-shadow: none !important; } |
e91641fe5
|
435 436 437 |
#jitsi-container { height: 100vh; } |
ac24ec07a
|
438 |
</style> |