Blame view

src/pages/Meet/meet.vue 6.01 KB
2226dee5a   Neeraj Sharma   implement confere...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  <template>
    <v-container fluid class="body-color">
      <v-card flat class="elevation-0 transparent">
        <v-flex xs12>
          <v-layout>
            <v-flex lg2>
              <v-select
                :items="addclass"
                label="Select Class"
                v-model="selectStudents.classId"
                item-text="classNum"
                item-value="_id"
                name="Select Class"
                :rules="classRules"
                class="ml-4"
              ></v-select>
            </v-flex>
            <!-- <v-flex xs3>
              <v-select
                :items="addSection"
                label="Select Section"
                v-model="selectStudents.selectSection"
                item-text="name"
                item-value="_id"
                name="Select Section"
                :rules="sectionRules"
                class="px-2"
                required
              ></v-select>
            </v-flex>-->
            <v-flex xs3>
e91641fe5   Amber Dev   solved bugs
32
33
34
35
36
              <v-btn
                @click="createRoom(selectStudents.classId)"
                round
                dark
                :loading="loading"
b0e0491ab   Shikha Mishra   solve the issue o...
37
                class="open-dialog-button"
e91641fe5   Amber Dev   solved bugs
38
              >Find</v-btn>
2226dee5a   Neeraj Sharma   implement confere...
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
            </v-flex>
          </v-layout>
        </v-flex>
      </v-card>
      <div id="jitsi-container"></div>
    </v-container>
  </template>
  <script>
  import http from "@/Services/http.js";
  import moment from "moment";
  
  export default {
    data() {
      return {
        token: "",
        selectStudents: {},
b0e0491ab   Shikha Mishra   solve the issue o...
55
56
        classRules: [(v) => !!v || " Class Name is required"],
        sectionRules: [(v) => !!v || " Section Name is required"],
2226dee5a   Neeraj Sharma   implement confere...
57
58
59
60
61
        addclass: [],
        addSection: [],
        loading: false,
        room: "",
        username: "",
b0e0491ab   Shikha Mishra   solve the issue o...
62
        roomPassword: "",
2226dee5a   Neeraj Sharma   implement confere...
63
64
65
66
67
68
      };
    },
    methods: {
      startConference() {
        var _this = this;
        try {
edfe025fa   Amber Dev   added jitsi meet
69
          const domain = "meet.intrack.in";
2226dee5a   Neeraj Sharma   implement confere...
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
          const options = {
            audioInput: "<deviceLabel>",
            audioOutput: "<deviceLabel>",
            videoInput: "<deviceLabel>",
            roomName: this.room,
            height: 500,
            parentNode: document.getElementById("jitsi-container"),
            interfaceConfigOverwrite: {
              filmStripOnly: false,
              SHOW_JITSI_WATERMARK: false,
              TOOLBAR_BUTTONS: [
                "microphone",
                "camera",
                "closedcaptions",
                "desktop",
                "fullscreen",
                "fodeviceselection",
                "hangup",
                "profile",
                "info",
                "chat",
531728c2e   Neeraj Sharma   add recodording o...
91
                "recording",
2226dee5a   Neeraj Sharma   implement confere...
92
93
94
95
96
97
98
99
100
101
102
                "livestreaming",
                "etherpad",
                "sharedvideo",
                "settings",
                "raisehand",
                "videoquality",
                "filmstrip",
                "invite",
                "feedback",
                "stats",
                "shortcuts",
b0e0491ab   Shikha Mishra   solve the issue o...
103
104
                "tileview",
              ],
2226dee5a   Neeraj Sharma   implement confere...
105
106
            },
            configOverwrite: {
b0e0491ab   Shikha Mishra   solve the issue o...
107
              disableSimulcast: false,
2226dee5a   Neeraj Sharma   implement confere...
108
109
            },
            teacherName: "",
b0e0491ab   Shikha Mishra   solve the issue o...
110
            romm: "",
2226dee5a   Neeraj Sharma   implement confere...
111
112
113
114
          };
  
          this.api = new JitsiMeetExternalAPI(domain, options);
          this.api.addEventListener("videoConferenceJoined", () => {
860da881d   Shikha Mishra   comment all consoles
115
            //   console.log("Local User Joined");
2226dee5a   Neeraj Sharma   implement confere...
116
117
118
119
120
  
            _this.api.executeCommand("displayName", _this.username);
            _this.api.executeCommand("password", this.roomPassword);
          });
        } catch (error) {
860da881d   Shikha Mishra   comment all consoles
121
122
123
124
          // console.error("Failed to load Jitsi API", error);
          this.snackbar = true;
          this.color = "error";
          this.text = error.response.data.message;
2226dee5a   Neeraj Sharma   implement confere...
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
        }
      },
      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");
        // }
      },
      getClassData() {
        http()
          .get("/getClassesList", {
b0e0491ab   Shikha Mishra   solve the issue o...
142
            headers: { Authorization: "Bearer " + this.token },
2226dee5a   Neeraj Sharma   implement confere...
143
          })
b0e0491ab   Shikha Mishra   solve the issue o...
144
          .then((response) => {
2226dee5a   Neeraj Sharma   implement confere...
145
146
            this.addclass = response.data.data;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
147
          .catch((error) => {
2226dee5a   Neeraj Sharma   implement confere...
148
149
150
151
152
153
154
155
156
            this.showLoader = false;
            if (error.response.status === 401) {
              this.$router.replace({ path: "/" });
              this.$store.dispatch("setToken", null);
              this.$store.dispatch("Id", null);
              this.$store.dispatch("Role", null);
            }
          });
      },
e91641fe5   Amber Dev   solved bugs
157
      createRoom(classId) {
2226dee5a   Neeraj Sharma   implement confere...
158
159
        this.showLoader = true;
        var classId = {
b0e0491ab   Shikha Mishra   solve the issue o...
160
          classId: classId,
2226dee5a   Neeraj Sharma   implement confere...
161
162
163
        };
        http()
          .post("/createRoom", classId)
b0e0491ab   Shikha Mishra   solve the issue o...
164
          .then((response) => {
2226dee5a   Neeraj Sharma   implement confere...
165
            // this.addSection = response.data.data;
860da881d   Shikha Mishra   comment all consoles
166
            //   console.log("CREATE___ROOOM", response.data);
2226dee5a   Neeraj Sharma   implement confere...
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
            this.room = response.data.data.roomName;
            this.username = response.data.data.teacherName;
            this.roomPassword = response.data.data.roomPassword;
            var this_ = this;
            if (this.username != "" || this.room != "") {
              if (window.JitsiMeetExternalAPI) {
                // var person = prompt("Please enter your name:", "Rabie");
                if (this_.username != null || this_.username != "") {
                  this.username = this.username;
                }
                // var room = prompt("Please enter your room:", "Test Room");
                if (this_.room != null || this_.room != "") {
                  this.room = this.room;
                }
                this.startConference();
              } else alert("Jitsi Meet API script not loaded");
            }
            this.showLoader = false;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
186
          .catch((err) => {
2226dee5a   Neeraj Sharma   implement confere...
187
188
            this.showLoader = false;
          });
b0e0491ab   Shikha Mishra   solve the issue o...
189
      },
2226dee5a   Neeraj Sharma   implement confere...
190
191
192
193
194
195
    },
  
    mounted() {
      this.token = this.$store.state.token;
      this.getClassData();
      // this.openRoom();
b0e0491ab   Shikha Mishra   solve the issue o...
196
    },
2226dee5a   Neeraj Sharma   implement confere...
197
198
199
200
201
202
203
204
205
  };
  </script>
  
  
  <style>
  #jitsi-container {
    height: 100vh;
  }
  </style>