Blame view

src/pages/Meet/meet.vue 5.89 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
          };
  
          this.api = new JitsiMeetExternalAPI(domain, options);
          this.api.addEventListener("videoConferenceJoined", () => {
            console.log("Local User Joined");
  
            _this.api.executeCommand("displayName", _this.username);
            _this.api.executeCommand("password", this.roomPassword);
          });
        } catch (error) {
          console.error("Failed to load Jitsi API", error);
        }
      },
      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...
139
            headers: { Authorization: "Bearer " + this.token },
2226dee5a   Neeraj Sharma   implement confere...
140
          })
b0e0491ab   Shikha Mishra   solve the issue o...
141
          .then((response) => {
2226dee5a   Neeraj Sharma   implement confere...
142
143
            this.addclass = response.data.data;
          })
b0e0491ab   Shikha Mishra   solve the issue o...
144
          .catch((error) => {
2226dee5a   Neeraj Sharma   implement confere...
145
146
147
148
149
150
151
152
153
            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
154
      createRoom(classId) {
2226dee5a   Neeraj Sharma   implement confere...
155
156
        this.showLoader = true;
        var classId = {
b0e0491ab   Shikha Mishra   solve the issue o...
157
          classId: classId,
2226dee5a   Neeraj Sharma   implement confere...
158
159
160
        };
        http()
          .post("/createRoom", classId)
b0e0491ab   Shikha Mishra   solve the issue o...
161
          .then((response) => {
2226dee5a   Neeraj Sharma   implement confere...
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
            // this.addSection = response.data.data;
            console.log("CREATE___ROOOM", response.data);
            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...
183
          .catch((err) => {
2226dee5a   Neeraj Sharma   implement confere...
184
185
            this.showLoader = false;
          });
b0e0491ab   Shikha Mishra   solve the issue o...
186
      },
2226dee5a   Neeraj Sharma   implement confere...
187
188
189
190
191
192
    },
  
    mounted() {
      this.token = this.$store.state.token;
      this.getClassData();
      // this.openRoom();
b0e0491ab   Shikha Mishra   solve the issue o...
193
    },
2226dee5a   Neeraj Sharma   implement confere...
194
195
196
197
198
199
200
201
202
  };
  </script>
  
  
  <style>
  #jitsi-container {
    height: 100vh;
  }
  </style>