|
|
@@ -1,11 +1,9 @@
|
|
|
<template>
|
|
|
<div id="app">
|
|
|
<template v-if="isLogin">
|
|
|
- <template v-if="!showLoading">
|
|
|
- <video id="v2" autoplay playsinline muted></video>
|
|
|
- <div class="marke"></div>
|
|
|
- </template>
|
|
|
- <Loading v-else />
|
|
|
+ <video id="v2" autoplay playsinline muted></video>
|
|
|
+ <div class="marke"></div>
|
|
|
+ <Loading v-if="showLoading" />
|
|
|
</template>
|
|
|
<Login v-else :err="error" @loginBack="login" />
|
|
|
</div>
|
|
|
@@ -52,17 +50,16 @@ export default {
|
|
|
if (this.Peer.iceGatheringState === "complete") {
|
|
|
const answer = this.Peer.localDescription;
|
|
|
this.socket.emit("msg", answer);
|
|
|
- this.showLoading = false
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// listen track
|
|
|
this.Peer.ontrack = (evt) => {
|
|
|
- console.log("track", evt.streams[0]);
|
|
|
+ console.log("track", evt);
|
|
|
this.remoteVideo = document.getElementById("v2");
|
|
|
this.remoteVideo.srcObject = evt.streams[0];
|
|
|
+ this.showLoading = false;
|
|
|
};
|
|
|
-
|
|
|
} catch (error) {
|
|
|
this.socket.disconnect();
|
|
|
this.isLogin = false;
|
|
|
@@ -71,8 +68,8 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.socket.on("msg", async (data) => {
|
|
|
- console.log(data);
|
|
|
if (data.type === "offer") {
|
|
|
+ console.log(data.sdp);
|
|
|
await this.Peer.setRemoteDescription(data);
|
|
|
const answer = await this.Peer.createAnswer();
|
|
|
await this.Peer.setLocalDescription(answer);
|
|
|
@@ -130,6 +127,7 @@ body {
|
|
|
user-select: none;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
|
|
|
video {
|