Blame view
src/pages/Dashboard/LiveOnlineClass.vue
12.4 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> |
d23a27a41
|
73 |
<v-btn round class="open-dialog-button" dark @click="showLoader = true;startChat()">Start Session</v-btn> |
ac24ec07a
|
74 75 |
</div> </v-flex> |
375b62cd1
|
76 |
<v-flex id="teacherClone"> |
e91641fe5
|
77 |
<div id="jitsi-container"></div> |
ac24ec07a
|
78 79 80 81 82 |
</v-flex> </v-layout> </v-flex> <v-spacer></v-spacer> |
e91641fe5
|
83 |
<!-- COURSES SIDE BAR- positioned to the right of the page --> |
de958fcfc
|
84 |
<!-- <v-flex xs3> |
ac24ec07a
|
85 |
<v-card class="elevation-0 card-border" height="100%"> |
e91641fe5
|
86 |
<CoursesSideBar></CoursesSideBar> |
ac24ec07a
|
87 |
</v-card> |
de958fcfc
|
88 |
</v-flex>--> |
ac24ec07a
|
89 90 91 92 93 94 95 96 |
</v-layout> </v-container> </div> </template> <script> import AllApiCalls from "@/Services/AllApiCalls.js"; import http from "@/Services/http.js"; import moment from "moment"; |
e91641fe5
|
97 98 |
import Meet from "@/pages/Meet/meet.vue"; import CoursesSideBar from "@/pages/Common/CoursesSideBar.vue"; |
ac24ec07a
|
99 100 |
export default { mixins: [AllApiCalls], |
e91641fe5
|
101 |
components: { |
375b62cd1
|
102 |
CoursesSideBar, |
e91641fe5
|
103 |
}, |
ac24ec07a
|
104 105 |
data() { return { |
e91641fe5
|
106 |
startLiveSession: "", |
852713654
|
107 |
studentBtn: "", |
ac24ec07a
|
108 109 110 111 |
// DATA TABLE search: "", pagination: { |
375b62cd1
|
112 |
rowsPerPage: 10, |
ac24ec07a
|
113 114 115 116 117 118 |
}, liveOnlineHeaders: [ { text: "Playback", value: "attachementUrl", sortable: false, |
375b62cd1
|
119 |
align: "center", |
ac24ec07a
|
120 121 122 123 124 |
}, { text: "Meeting", align: "center", sortable: false, |
375b62cd1
|
125 |
value: "", |
ac24ec07a
|
126 127 128 129 130 |
}, { text: "Recording", value: "", sortable: false, |
375b62cd1
|
131 |
align: "center", |
ac24ec07a
|
132 133 134 135 136 |
}, { text: "Description Preview", value: "", sortable: false, |
375b62cd1
|
137 |
align: "center", |
ac24ec07a
|
138 139 140 |
}, { text: "Date", value: "", sortable: false, align: "center" }, { text: "Duration", value: "", sortable: false, align: "center" }, |
375b62cd1
|
141 |
{ text: "Toolbar", value: "", sortable: false, align: "center" }, |
ac24ec07a
|
142 143 |
], liveOnlineItems: [], |
e91641fe5
|
144 |
// JITSI CONTAINER |
edfe025fa
|
145 |
liveLink: "", |
e91641fe5
|
146 147 |
token: "", selectStudents: {}, |
375b62cd1
|
148 149 |
classRules: [(v) => !!v || " Class Name is required"], sectionRules: [(v) => !!v || " Section Name is required"], |
e91641fe5
|
150 151 152 153 154 |
addclass: [], addSection: [], loading: false, room: "", username: "", |
375b62cd1
|
155 156 |
roomPassword: "", counter: 0, |
ac24ec07a
|
157 158 159 |
}; }, methods: { |
6e1cb5c96
|
160 |
async startChat() { |
375b62cd1
|
161 |
if (this.$store.state.role === "PARENT") { |
9a4a64725
|
162 |
if (this.counter == 0) { |
a690a86fb
|
163 |
console.log("enter start chat"); |
fa975e45a
|
164 |
this.startConference(); |
9a4a64725
|
165 |
this.counter += 1; |
6e1cb5c96
|
166 |
} |
375b62cd1
|
167 168 |
} if (this.$store.state.role === "TEACHER") { |
9a4a64725
|
169 |
if (this.counter == 0) { |
fa975e45a
|
170 |
this.createRoom(); |
9a4a64725
|
171 |
this.counter += 1; |
fa975e45a
|
172 |
} |
375b62cd1
|
173 174 |
} }, |
e91641fe5
|
175 176 |
// JITSI CONTAINER startConference() { |
375b62cd1
|
177 |
console.log("yes session started"); |
e91641fe5
|
178 179 |
var _this = this; try { |
01a388dfe
|
180 |
const domain = "meet.intrack.in"; |
e91641fe5
|
181 182 183 184 |
const options = { audioInput: "<deviceLabel>", audioOutput: "<deviceLabel>", videoInput: "<deviceLabel>", |
edfe025fa
|
185 |
prejoinPageEnabled: false, |
e91641fe5
|
186 187 188 189 190 |
roomName: this.room, height: 500, parentNode: document.getElementById("jitsi-container"), interfaceConfigOverwrite: { filmStripOnly: false, |
9a4a64725
|
191 192 |
SHOW_PROMOTIONAL_CLOSE_PAGE: false, SHOW_POWERED_BY: false, |
e91641fe5
|
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
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
|
217 218 |
"tileview", ], |
e91641fe5
|
219 220 |
}, configOverwrite: { |
375b62cd1
|
221 |
disableSimulcast: false, |
e91641fe5
|
222 223 |
}, teacherName: "", |
375b62cd1
|
224 |
romm: "", |
e91641fe5
|
225 |
}; |
a690a86fb
|
226 227 228 |
_this.api = new JitsiMeetExternalAPI(domain, options); console.log("this.api ", this.api); _this.api.addEventListener("videoConferenceJoined", () => { |
e91641fe5
|
229 |
console.log("Local User Joined"); |
ac24ec07a
|
230 |
|
e91641fe5
|
231 |
_this.api.executeCommand("displayName", _this.username); |
a690a86fb
|
232 |
_this.api.executeCommand("password", this_.roomPassword); |
ac24ec07a
|
233 |
}); |
a690a86fb
|
234 235 |
_this.api.on("readyToClose", () => { this.$router.push({ name: "Refresh" }); |
db965de89
|
236 |
this.showLoader = false; |
9a4a64725
|
237 |
}); |
e91641fe5
|
238 239 |
} catch (error) { console.error("Failed to load Jitsi API", error); |
ac24ec07a
|
240 241 |
} }, |
e91641fe5
|
242 243 244 245 246 247 248 249 250 251 252 |
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
|
253 |
}, |
e91641fe5
|
254 |
createRoom(classId) { |
ac24ec07a
|
255 |
this.showLoader = true; |
e91641fe5
|
256 |
var classId = { |
375b62cd1
|
257 |
classId: classId, |
ac24ec07a
|
258 259 |
}; http() |
e91641fe5
|
260 261 262 |
.post("/createLiveClasses", { classId: this.$route.query.classId, courseId: this.$route.query.courseId, |
375b62cd1
|
263 |
chapterId: this.$route.query.chapterId, |
ac24ec07a
|
264 |
}) |
375b62cd1
|
265 |
.then((response) => { |
e91641fe5
|
266 267 |
// this.addSection = response.data.data; console.log("CREATE___ROOOM", response.data); |
a690a86fb
|
268 269 270 271 272 273 274 275 276 277 278 |
var room = response.data.data.roomName; var username = localStorage.getItem("teacherName") var roomPassword = response.data.data.password; console.log( "room", room, "username", username, "roomPassword", roomPassword ); |
e91641fe5
|
279 |
var this_ = this; |
a690a86fb
|
280 |
if (username != "" || room != "") { |
e91641fe5
|
281 282 |
if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); |
a690a86fb
|
283 284 |
if (username != null || username != "") { this_.username = username; |
e91641fe5
|
285 286 |
} // var room = prompt("Please enter your room:", "Test Room"); |
a690a86fb
|
287 288 289 290 291 |
if (room != null || room != "") { this_.room = room; } if (roomPassword != null || roomPassword != "") { this_.password = roomPassword; |
e91641fe5
|
292 |
} |
e91641fe5
|
293 |
} else alert("Jitsi Meet API script not loaded"); |
a690a86fb
|
294 |
this_.startConference(); |
e91641fe5
|
295 |
} |
ac24ec07a
|
296 |
this.showLoader = false; |
ac24ec07a
|
297 |
}) |
375b62cd1
|
298 |
.catch((err) => { |
ac24ec07a
|
299 300 |
this.showLoader = false; }); |
375b62cd1
|
301 302 |
}, async studentClasses() { |
fa975e45a
|
303 304 305 306 |
this.liveLink = ""; this.room = ""; this.username = ""; this.roomPassword = ""; |
375b62cd1
|
307 308 309 310 311 312 313 |
/* 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, }); console.log("response getLiveClassesesList- ", response); |
852713654
|
314 |
|
375b62cd1
|
315 |
/* CHECK RESPONSE TO ASSIGN MESSAGE INSIDE BUTTON */ |
6e1cb5c96
|
316 317 318 319 320 321 322 323 |
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
|
324 325 326 327 328 |
if (response.data.data.length == 0) { this.startLiveSession = "Start Session"; this.studentBtn = ""; } else { this.liveLink = response.data.data[0].link; |
fa975e45a
|
329 |
var room = response.data.data[0].roomName; |
a690a86fb
|
330 331 |
var username = this.currentUser; var roomPassword = response.data.data[0].password; |
375b62cd1
|
332 |
var this_ = this; |
a690a86fb
|
333 |
// console.log(this.room, this.roomPassword, this.username); |
edfe025fa
|
334 |
|
fa975e45a
|
335 |
if (username != "" || room != "") { |
375b62cd1
|
336 337 |
if (window.JitsiMeetExternalAPI) { // var person = prompt("Please enter your name:", "Rabie"); |
fa975e45a
|
338 |
if (username != null || username != "") { |
a690a86fb
|
339 340 341 342 |
this_.username = username; } if (roomPassword != null || roomPassword != "") { this_.roomPassword = roomPassword; |
375b62cd1
|
343 344 |
} // var room = prompt("Please enter your room:", "Test Room"); |
fa975e45a
|
345 |
if (room != null || room != "") { |
a690a86fb
|
346 |
this_.room = room; |
375b62cd1
|
347 |
} |
6e1cb5c96
|
348 |
// this.startConference(); |
edfe025fa
|
349 |
} |
edfe025fa
|
350 |
} |
852713654
|
351 |
} |
375b62cd1
|
352 353 |
}, }, |
375b62cd1
|
354 |
async created() { |
a690a86fb
|
355 356 357 358 359 |
console.log( "this.$store.state.studentsData", this.$store.state.studentsData[0].name ); this.currentUser = localStorage.getItem("studentName"); |
fa975e45a
|
360 |
this.token = this.$store.state.token; |
375b62cd1
|
361 |
if (this.$store.state.role === "PARENT") { |
6e1cb5c96
|
362 |
await this.studentClasses(); |
e91641fe5
|
363 364 365 366 367 368 |
} /* getStudentCourses - to get courseData - defined in GetApis.js*/ if (this.$store.state.role === "PARENT") { await this.getStudentCourses({ classId: localStorage.getItem("parentClassId"), |
375b62cd1
|
369 |
studentId: localStorage.getItem("parentStudentId"), |
e91641fe5
|
370 371 |
}); } |
375b62cd1
|
372 |
}, |
ac24ec07a
|
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 |
}; </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
|
400 401 402 |
#jitsi-container { height: 100vh; } |
ac24ec07a
|
403 |
</style> |