|
@@ -24,7 +24,7 @@
|
|
|
<v-stepper-content step="1">
|
|
|
<v-card class="mb-12" color="grey lighten-1" height="200px">
|
|
|
<div class="checkin-form d-flex justify-content-center align-items-center">
|
|
|
- <div>
|
|
|
+ <form ref="baseForm">
|
|
|
<!-- <input type="hidden" name="lobbyUid" value />
|
|
|
<input type="hidden" name="_api" value="/api/meeting/createAsStrangerPerformer" />
|
|
|
<input type="hidden" name="_success" value="/pro/login" />
|
|
@@ -42,7 +42,7 @@
|
|
|
<div class="input-group mb-3">
|
|
|
<input type="date" name="strangerDob" class="form-control" placeholder="Date of Birth" v-model="user.dateOfBirth" required />
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </form>
|
|
|
</div>
|
|
|
</v-card>
|
|
|
|
|
@@ -108,6 +108,16 @@ import { mapState } from "vuex";
|
|
|
|
|
|
import VueGridLayout from "vue-grid-layout";
|
|
|
|
|
|
+import VueSocketIO from "vue-socket.io";
|
|
|
+import SocketIO from "socket.io-client";
|
|
|
+
|
|
|
+Vue.use(
|
|
|
+ new VueSocketIO({
|
|
|
+ debug: true,
|
|
|
+ connection: SocketIO(process.env.MIX_SOCKET_SERVICE_URL)
|
|
|
+ })
|
|
|
+);
|
|
|
+
|
|
|
export default {
|
|
|
components: {
|
|
|
GridLayout: VueGridLayout.GridLayout,
|
|
@@ -120,12 +130,11 @@ export default {
|
|
|
},
|
|
|
meetingProp: {
|
|
|
type: Object
|
|
|
+ },
|
|
|
+ clientUid: {
|
|
|
+ type: String,
|
|
|
+ required: true
|
|
|
}
|
|
|
- // ,
|
|
|
- // lobby_uid: {
|
|
|
- // type: String,
|
|
|
- // required: true
|
|
|
- // }
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -135,7 +144,8 @@ export default {
|
|
|
dateOfBirth: null
|
|
|
},
|
|
|
meetingUid: "",
|
|
|
- stepper: 1,
|
|
|
+ meetingName: sessionStorage.getItem("meeting_name") || "",
|
|
|
+ stepper: sessionStorage.getItem("step") || 1,
|
|
|
cameraWorkingConfirmed: false,
|
|
|
loading: false,
|
|
|
/* Copied */
|
|
@@ -159,11 +169,47 @@ export default {
|
|
|
loadingInProgress: false
|
|
|
};
|
|
|
},
|
|
|
+ sockets: {},
|
|
|
+ watch: {
|
|
|
+ publisherReady(val) {
|
|
|
+ if (val && this.sessionConnected) this.publishToSession();
|
|
|
+ },
|
|
|
+ sessionConnected(val) {
|
|
|
+ if (val && this.publisherReady) this.publishToSession();
|
|
|
+ },
|
|
|
+ "user.is_active_and_visible"(val) {
|
|
|
+ if (!this.publisher || !this.publisher.publishVideo) return;
|
|
|
+ this.publisher.publishVideo(val);
|
|
|
+ this.publisher.publishAudio(val);
|
|
|
+ },
|
|
|
+ "meeting.id"(val) {
|
|
|
+ if (this.loadingInProgress) return;
|
|
|
+ this.loadingInProgress = true;
|
|
|
+ this.disconnect();
|
|
|
+
|
|
|
+ if (val) {
|
|
|
+ this.getToken({}, true);
|
|
|
+ } else {
|
|
|
+ this.loadingInProgress = false;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ stepper: {
|
|
|
+ handler(newVal) {
|
|
|
+ sessionStorage.setItem("step", newVal);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
checkIn() {
|
|
|
this.loading = true;
|
|
|
+ this.meetingName = `${this.user.firstName} ${this.user.lastName} ${this.user.dateOfBirth}`;
|
|
|
+ if (!this.$refs.baseForm.reportValidity()) {
|
|
|
+ this.loading = false;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
$.ajax({
|
|
|
- url: "/post-to-api",
|
|
|
+ url: "/post-to-api-ajax",
|
|
|
method: "POST",
|
|
|
headers: {
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
|
|
@@ -172,15 +218,35 @@ export default {
|
|
|
data: {
|
|
|
_api: "/api/meeting/createAsStrangerPerformer",
|
|
|
lobbyUid: this.lobbyProp.uid,
|
|
|
- title: `${this.user.firstName} ${this.user.lastName} ${this.user.dateOfBirth}`,
|
|
|
+ title: this.meetingName,
|
|
|
strangerFirstName: this.user.firstName,
|
|
|
strangerLastName: this.user.lastName,
|
|
|
strangerDob: this.user.dateOfBirth
|
|
|
},
|
|
|
success: data => {
|
|
|
+ if (!data.success) {
|
|
|
+ alert(data.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
this.stepper = 2;
|
|
|
this.meetingUid = data.data;
|
|
|
- this.$nextTick(this.initializePublisher);
|
|
|
+
|
|
|
+ this.$socket.emit("userData", {
|
|
|
+ user: {
|
|
|
+ uid: this.clientUid,
|
|
|
+ name: `${this.firstName} ${this.lastName}`,
|
|
|
+ type: "STRANGER"
|
|
|
+ },
|
|
|
+ meeting: {
|
|
|
+ uid: this.meetingUid,
|
|
|
+ lobby_uid: this.lobbyProp.uid
|
|
|
+ },
|
|
|
+ lobbies_uid_list: [`${this.lobbyProp.uid}`]
|
|
|
+ });
|
|
|
+
|
|
|
+ if (!this.publisher) {
|
|
|
+ this.$nextTick(this.initializePublisher);
|
|
|
+ }
|
|
|
},
|
|
|
error: jXhr => {},
|
|
|
complete: () => {
|
|
@@ -215,6 +281,10 @@ export default {
|
|
|
cont.obj = this.publisher;
|
|
|
this.$set(cont, "self", true);
|
|
|
this.cameraWorkingConfirmed = true;
|
|
|
+
|
|
|
+ if (this.stepper == 3) {
|
|
|
+ this.gotoStep3();
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
}
|
|
@@ -229,7 +299,10 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
gotoStep3() {
|
|
|
- this.stepper = 3;
|
|
|
+ if (this.stepper != 3) {
|
|
|
+ this.stepper = 3;
|
|
|
+ }
|
|
|
+
|
|
|
this.videoGridPreview = [];
|
|
|
this.adjustVideoContainers();
|
|
|
this.$nextTick(() => {
|
|
@@ -237,6 +310,17 @@ export default {
|
|
|
cont.el = $(`#${cont.id}`)[0];
|
|
|
cont.el.appendChild(cont.obj.element);
|
|
|
this.getToken();
|
|
|
+
|
|
|
+ this.$socket.emit("meetingJoined", {
|
|
|
+ lobby_uid: this.lobbyProp.uid,
|
|
|
+ meeting_name: this.meetingName,
|
|
|
+ meeting_uid: this.meetingUid,
|
|
|
+ user: {
|
|
|
+ name: `${this.firstName} ${this.lastName}`,
|
|
|
+ type: "STRANGER",
|
|
|
+ uid: this.clientUid
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
},
|
|
|
/* Copied */
|
|
@@ -254,14 +338,13 @@ export default {
|
|
|
if (this.screenPublisher) {
|
|
|
this.screenPublisher.destroy();
|
|
|
this.screenPublisher = null;
|
|
|
- this.$store.commit("setScreenShareState", null);
|
|
|
}
|
|
|
},
|
|
|
getToken() {
|
|
|
// if (this.meeting.scheduledDate && !this.meeting.startedAt && this.meeting.scheduledDate > new Date() && (this.user.type === "guest" || !confirm("Meeting not started. Start it now?")))
|
|
|
// return;
|
|
|
$.ajax({
|
|
|
- url: "/post-to-api",
|
|
|
+ url: "/post-to-api-ajax",
|
|
|
method: "POST",
|
|
|
headers: {
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
|
|
@@ -271,6 +354,10 @@ export default {
|
|
|
uid: this.meetingUid
|
|
|
},
|
|
|
success: data => {
|
|
|
+ if (!data.success) {
|
|
|
+ alert(data.message);
|
|
|
+ return;
|
|
|
+ }
|
|
|
// this.$refs.initialModal.hide();
|
|
|
// if (!isAssociate) {
|
|
|
// const user = Object.assign({}, this.user);
|
|
@@ -401,7 +488,8 @@ export default {
|
|
|
this.openTokSession.on({
|
|
|
sessionDisconnected: event => {
|
|
|
if (event.reason === "forceDisconnected") {
|
|
|
- alert("You were kicked.");
|
|
|
+ alert("You were kicked out of meeting.");
|
|
|
+ //window.location.reload();
|
|
|
//TODO: Kicked
|
|
|
// if (this.user.type === "associate") {
|
|
|
// this.disconnect();
|
|
@@ -494,9 +582,9 @@ export default {
|
|
|
this.subscribers.push(subscriber);
|
|
|
});
|
|
|
|
|
|
- console.log(sessionId);
|
|
|
+ /* console.log(sessionId);
|
|
|
console.log(token);
|
|
|
- console.log(apiKey);
|
|
|
+ console.log(apiKey); */
|
|
|
this.openTokSession.connect(token, error => {
|
|
|
// If the connection is successful, publish to the session
|
|
|
if (error) {
|
|
@@ -518,7 +606,7 @@ export default {
|
|
|
this.$nextTick(function() {
|
|
|
this.readyForUse = true;
|
|
|
if (this.user.type === "associate") {
|
|
|
- if (!this.meeting.id || this.active_menu_item.template !== "room") return;
|
|
|
+ if (!this.meeting.id) return;
|
|
|
this.getToken({}, true);
|
|
|
return;
|
|
|
}
|
|
@@ -538,36 +626,41 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- publisherReady(val) {
|
|
|
- if (val && this.sessionConnected) this.publishToSession();
|
|
|
- },
|
|
|
- sessionConnected(val) {
|
|
|
- if (val && this.publisherReady) this.publishToSession();
|
|
|
- },
|
|
|
- "user.is_active_and_visible"(val) {
|
|
|
- if (!this.publisher || !this.publisher.publishVideo) return;
|
|
|
- this.publisher.publishVideo(val);
|
|
|
- this.publisher.publishAudio(val);
|
|
|
- },
|
|
|
- "meeting.id"(val) {
|
|
|
- if (this.loadingInProgress) return;
|
|
|
- this.loadingInProgress = true;
|
|
|
- this.disconnect();
|
|
|
-
|
|
|
- if (val) {
|
|
|
- this.getToken({}, true);
|
|
|
- } else {
|
|
|
- this.loadingInProgress = false;
|
|
|
+ created() {
|
|
|
+ if (this.meetingProp) {
|
|
|
+ this.user.firstName = this.meetingProp.strangerFirstName;
|
|
|
+ this.user.lastName = this.meetingProp.strangerLastName;
|
|
|
+ this.user.dateOfBirth = this.meetingProp.strangerDob;
|
|
|
+
|
|
|
+ if (this.stepper == 1) {
|
|
|
+ this.stepper = 2;
|
|
|
}
|
|
|
- },
|
|
|
- "active_menu_item.template"(val) {
|
|
|
- if (this.loadingInProgress || val !== "room" || !this.meeting.id || this.openTokSession) return;
|
|
|
- this.loadingInProgress = true;
|
|
|
- this.getToken({}, true);
|
|
|
+
|
|
|
+ this.$socket.emit("userData", {
|
|
|
+ user: {
|
|
|
+ uid: this.clientUid,
|
|
|
+ name: `${this.firstName} ${this.lastName}`,
|
|
|
+ type: "STRANGER"
|
|
|
+ },
|
|
|
+ meeting: {
|
|
|
+ uid: this.meetingUid,
|
|
|
+ lobby_uid: this.lobbyProp.uid
|
|
|
+ },
|
|
|
+ lobbies_uid_list: [`${this.lobbyProp.uid}`]
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
mounted() {
|
|
|
+ if (this.meetingProp) {
|
|
|
+ this.meetingUid = this.meetingProp.uid;
|
|
|
+ this.$nextTick(this.initializePublisher);
|
|
|
+ let self = this;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.sockets.subscribe("meeting-closed", data => {
|
|
|
+ this.$eventBus.$emit("leaveMeeting")
|
|
|
+ })
|
|
|
+
|
|
|
let self = this;
|
|
|
|
|
|
this.$eventBus.$on("meetingRejoin", () => {
|
|
@@ -590,17 +683,19 @@ export default {
|
|
|
|
|
|
this.$eventBus.$on("leaveMeeting", () => {
|
|
|
$.ajax({
|
|
|
- url: "/associate/meeting/leave",
|
|
|
+ url: "/post-to-api-ajax",
|
|
|
method: "POST",
|
|
|
headers: {
|
|
|
"X-CSRF-TOKEN": $('meta[name="csrf-token"]').attr("content")
|
|
|
},
|
|
|
error: jXhr => {
|
|
|
- console.error(getSingleError(jXhr));
|
|
|
+ console.error(getSingleError(jXhr))
|
|
|
}
|
|
|
});
|
|
|
- this.$store.dispatch("leaveMeeting");
|
|
|
- this.disconnect();
|
|
|
+ this.$store.dispatch("leaveMeeting")
|
|
|
+ this.$socket.emit('meetingLeft')
|
|
|
+ this.disconnect()
|
|
|
+ alert('Meeting was Closed.')
|
|
|
});
|
|
|
}
|
|
|
};
|