Blame view
src/pages/Dashboard/LiveOnlineClass.vue
12.5 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 38 39 |
</v-flex> <!-- JOIN OR END SESSION --> <v-flex> <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 71 72 |
</v-flex> <!-- JOIN OR END SESSION --> <v-flex> <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, |
ac24ec07a
|
162 163 164 |
}; }, methods: { |
6e1cb5c96
|
165 |
async startChat() { |
375b62cd1
|
166 |
if (this.$store.state.role === "PARENT") { |
9a4a64725
|
167 |
if (this.counter == 0) { |
860da881d
|
168 |
// console.log("enter start chat"); |
fa975e45a
|
169 |
this.startConference(); |
9a4a64725
|
170 |
this.counter += 1; |
6e1cb5c96
|
171 |
} |
375b62cd1
|
172 173 |
} if (this.$store.state.role === "TEACHER") { |
9a4a64725
|
174 |
if (this.counter == 0) { |
fa975e45a
|
175 |
this.createRoom(); |
9a4a64725
|
176 |
this.counter += 1; |
fa975e45a
|
177 |
} |
375b62cd1
|
178 179 |
} }, |
e91641fe5
|
180 181 |
// JITSI CONTAINER startConference() { |
860da881d
|
182 |
// console.log("yes session started"); |
e91641fe5
|
183 184 |
var _this = this; try { |
01a388dfe
|
185 |
const domain = "meet.intrack.in"; |
e91641fe5
|
186 187 188 189 |
const options = { audioInput: "<deviceLabel>", audioOutput: "<deviceLabel>", videoInput: "<deviceLabel>", |
edfe025fa
|
190 |
prejoinPageEnabled: false, |
e91641fe5
|
191 192 193 194 195 |
roomName: this.room, height: 500, parentNode: document.getElementById("jitsi-container"), interfaceConfigOverwrite: { filmStripOnly: false, |
9a4a64725
|
196 197 |
SHOW_PROMOTIONAL_CLOSE_PAGE: false, SHOW_POWERED_BY: false, |
e91641fe5
|
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
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
|
222 223 |
"tileview", ], |
e91641fe5
|
224 225 |
}, configOverwrite: { |
375b62cd1
|
226 |
disableSimulcast: false, |
e91641fe5
|
227 228 |
}, teacherName: "", |
375b62cd1
|
229 |
romm: "", |
e91641fe5
|
230 |
}; |
a690a86fb
|
231 |
_this.api = new JitsiMeetExternalAPI(domain, options); |
860da881d
|
232 |
// console.log("this.api ", this.api); |
a690a86fb
|
233 |
_this.api.addEventListener("videoConferenceJoined", () => { |
860da881d
|
234 |
// console.log("Local User Joined"); |
90bec8782
|
235 |
this.showLoader = false; |
e91641fe5
|
236 |
_this.api.executeCommand("displayName", _this.username); |
a690a86fb
|
237 |
_this.api.executeCommand("password", this_.roomPassword); |
ac24ec07a
|
238 |
}); |
860da881d
|
239 |
|
a690a86fb
|
240 241 |
_this.api.on("readyToClose", () => { this.$router.push({ name: "Refresh" }); |
9a4a64725
|
242 |
}); |
e91641fe5
|
243 |
} catch (error) { |
860da881d
|
244 |
// console.error("Failed to load Jitsi API", error); |
ac24ec07a
|
245 246 |
} }, |
e91641fe5
|
247 248 249 250 251 252 253 254 255 256 257 |
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
|
258 |
}, |
e91641fe5
|
259 |
createRoom(classId) { |
8b7976c3a
|
260 |
// this.showLoader = true; |
e91641fe5
|
261 |
var classId = { |
375b62cd1
|
262 |
classId: classId, |
ac24ec07a
|
263 264 |
}; http() |
e91641fe5
|
265 266 267 |
.post("/createLiveClasses", { classId: this.$route.query.classId, courseId: this.$route.query.courseId, |
375b62cd1
|
268 |
chapterId: this.$route.query.chapterId, |
ac24ec07a
|
269 |
}) |
375b62cd1
|
270 |
.then((response) => { |
e91641fe5
|
271 |
// this.addSection = response.data.data; |
860da881d
|
272 |
// console.log("CREATE___ROOOM", response.data); |
a690a86fb
|
273 |
var room = response.data.data.roomName; |
860da881d
|
274 |
var username = localStorage.getItem("teacherName"); |
a690a86fb
|
275 |
var roomPassword = response.data.data.password; |
860da881d
|
276 277 278 279 280 281 282 283 |
// console.log( // "room", // room, // "username", // username, // "roomPassword", // roomPassword // ); |
e91641fe5
|
284 |
var this_ = this; |
a690a86fb
|
285 |
if (username != "" || room != "") { |
e91641fe5
|
286 287 |
if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); |
a690a86fb
|
288 289 |
if (username != null || username != "") { this_.username = username; |
e91641fe5
|
290 291 |
} // var room = prompt("Please enter your room:", "Test Room"); |
a690a86fb
|
292 293 294 295 296 |
if (room != null || room != "") { this_.room = room; } if (roomPassword != null || roomPassword != "") { this_.password = roomPassword; |
e91641fe5
|
297 |
} |
e91641fe5
|
298 |
} else alert("Jitsi Meet API script not loaded"); |
a690a86fb
|
299 |
this_.startConference(); |
e91641fe5
|
300 |
} |
ac24ec07a
|
301 |
}) |
375b62cd1
|
302 |
.catch((err) => { |
ac24ec07a
|
303 304 |
this.showLoader = false; }); |
375b62cd1
|
305 306 |
}, async studentClasses() { |
fa975e45a
|
307 308 309 310 |
this.liveLink = ""; this.room = ""; this.username = ""; this.roomPassword = ""; |
375b62cd1
|
311 312 313 314 315 316 |
/* 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
|
317 |
// console.log("response getLiveClassesesList- ", response); |
852713654
|
318 |
|
375b62cd1
|
319 |
/* CHECK RESPONSE TO ASSIGN MESSAGE INSIDE BUTTON */ |
6e1cb5c96
|
320 321 322 323 324 325 326 327 |
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
|
328 329 330 331 332 |
if (response.data.data.length == 0) { this.startLiveSession = "Start Session"; this.studentBtn = ""; } else { this.liveLink = response.data.data[0].link; |
fa975e45a
|
333 |
var room = response.data.data[0].roomName; |
a690a86fb
|
334 335 |
var username = this.currentUser; var roomPassword = response.data.data[0].password; |
375b62cd1
|
336 |
var this_ = this; |
a690a86fb
|
337 |
// console.log(this.room, this.roomPassword, this.username); |
edfe025fa
|
338 |
|
fa975e45a
|
339 |
if (username != "" || room != "") { |
375b62cd1
|
340 341 |
if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); |
fa975e45a
|
342 |
if (username != null || username != "") { |
a690a86fb
|
343 344 345 346 |
this_.username = username; } if (roomPassword != null || roomPassword != "") { this_.roomPassword = roomPassword; |
375b62cd1
|
347 348 |
} // var room = prompt("Please enter your room:", "Test Room"); |
fa975e45a
|
349 |
if (room != null || room != "") { |
a690a86fb
|
350 |
this_.room = room; |
375b62cd1
|
351 |
} |
6e1cb5c96
|
352 |
// this.startConference(); |
edfe025fa
|
353 |
} |
edfe025fa
|
354 |
} |
852713654
|
355 |
} |
375b62cd1
|
356 357 |
}, }, |
375b62cd1
|
358 |
async created() { |
860da881d
|
359 360 361 362 |
// console.log( // "this.$store.state.studentsData", // this.$store.state.studentsData[0].name // ); |
a690a86fb
|
363 |
this.currentUser = localStorage.getItem("studentName"); |
fa975e45a
|
364 |
this.token = this.$store.state.token; |
375b62cd1
|
365 |
if (this.$store.state.role === "PARENT") { |
6e1cb5c96
|
366 |
await this.studentClasses(); |
e91641fe5
|
367 368 369 370 371 372 |
} /* getStudentCourses - to get courseData - defined in GetApis.js*/ if (this.$store.state.role === "PARENT") { await this.getStudentCourses({ classId: localStorage.getItem("parentClassId"), |
375b62cd1
|
373 |
studentId: localStorage.getItem("parentStudentId"), |
e91641fe5
|
374 375 |
}); } |
375b62cd1
|
376 |
}, |
ac24ec07a
|
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 |
}; </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
|
404 405 406 |
#jitsi-container { height: 100vh; } |
ac24ec07a
|
407 |
</style> |