|
@@ -4,32 +4,22 @@
|
|
|
<video id="v2" autoplay playsinline muted></video>
|
|
<video id="v2" autoplay playsinline muted></video>
|
|
|
<div class="marke">
|
|
<div class="marke">
|
|
|
<!-- 手柄状态 -->
|
|
<!-- 手柄状态 -->
|
|
|
- <svg
|
|
|
|
|
- viewBox="0 -50 1024 1024"
|
|
|
|
|
- version="1.1"
|
|
|
|
|
- xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
- width="30"
|
|
|
|
|
- height="30"
|
|
|
|
|
- >
|
|
|
|
|
|
|
+ <svg viewBox="0 -50 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="30">
|
|
|
<path
|
|
<path
|
|
|
d="M817.68 803.17a130.23 130.23 0 0 1-125.6-96.37l-14-52.19a54.08 54.08 0 0 0-52.16-40H398.07a54.08 54.08 0 0 0-52.16 40l-14 52.19c-15.54 58-68.21 96.37-125.6 96.37A130 130 0 0 1 80.78 639.51l66.72-249a181.66 181.66 0 0 1 63.19-97.15A177.79 177.79 0 0 1 322 254.58h380a177.79 177.79 0 0 1 111.31 38.79 181.66 181.66 0 0 1 63.19 97.15l66.72 249a130 130 0 0 1-125.54 163.65zM322 274.58A160 160 0 0 0 166.87 395.5v0.13l-66.73 249a110 110 0 0 0 212.5 56.94l14-52.19a74.11 74.11 0 0 1 71.48-54.85h227.81a74.11 74.11 0 0 1 71.48 54.85l14 52.19a110 110 0 0 0 212.5-56.94L857.13 395.5A160 160 0 0 0 702 274.58z"
|
|
d="M817.68 803.17a130.23 130.23 0 0 1-125.6-96.37l-14-52.19a54.08 54.08 0 0 0-52.16-40H398.07a54.08 54.08 0 0 0-52.16 40l-14 52.19c-15.54 58-68.21 96.37-125.6 96.37A130 130 0 0 1 80.78 639.51l66.72-249a181.66 181.66 0 0 1 63.19-97.15A177.79 177.79 0 0 1 322 254.58h380a177.79 177.79 0 0 1 111.31 38.79 181.66 181.66 0 0 1 63.19 97.15l66.72 249a130 130 0 0 1-125.54 163.65zM322 274.58A160 160 0 0 0 166.87 395.5v0.13l-66.73 249a110 110 0 0 0 212.5 56.94l14-52.19a74.11 74.11 0 0 1 71.48-54.85h227.81a74.11 74.11 0 0 1 71.48 54.85l14 52.19a110 110 0 0 0 212.5-56.94L857.13 395.5A160 160 0 0 0 702 274.58z"
|
|
|
- :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
|
|
|
|
|
- ></path>
|
|
|
|
|
|
|
+ :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"></path>
|
|
|
<path
|
|
<path
|
|
|
d="M580 213.86a12 12 0 0 1 12 12v28H432v-28a12 12 0 0 1 12-12h136m0-20H444a32 32 0 0 0-32 32v48h200v-48a32 32 0 0 0-32-32z"
|
|
d="M580 213.86a12 12 0 0 1 12 12v28H432v-28a12 12 0 0 1 12-12h136m0-20H444a32 32 0 0 0-32 32v48h200v-48a32 32 0 0 0-32-32z"
|
|
|
- :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
|
|
|
|
|
- ></path>
|
|
|
|
|
|
|
+ :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"></path>
|
|
|
<path
|
|
<path
|
|
|
d="M512 213.86a10 10 0 0 1-10-10v-63a60.07 60.07 0 0 1 60-60 10 10 0 0 1 0 20 40 40 0 0 0-40 40v63a10 10 0 0 1-10 10zM330 344.86a90 90 0 1 1-90 90 90.1 90.1 0 0 1 90-90m0-20a110 110 0 1 0 110 110 110 110 0 0 0-110-110z"
|
|
d="M512 213.86a10 10 0 0 1-10-10v-63a60.07 60.07 0 0 1 60-60 10 10 0 0 1 0 20 40 40 0 0 0-40 40v63a10 10 0 0 1-10 10zM330 344.86a90 90 0 1 1-90 90 90.1 90.1 0 0 1 90-90m0-20a110 110 0 1 0 110 110 110 110 0 0 0-110-110z"
|
|
|
- :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
|
|
|
|
|
- ></path>
|
|
|
|
|
|
|
+ :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"></path>
|
|
|
<path
|
|
<path
|
|
|
d="M330 384.86a50 50 0 1 1-50 50 50.06 50.06 0 0 1 50-50m0-20a70 70 0 1 0 70 70 70 70 0 0 0-70-70zM697 344.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM697 496.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM773 420.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM621 420.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34z"
|
|
d="M330 384.86a50 50 0 1 1-50 50 50.06 50.06 0 0 1 50-50m0-20a70 70 0 1 0 70 70 70 70 0 0 0-70-70zM697 344.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM697 496.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM773 420.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34zM621 420.86a14 14 0 1 1-14 14 14 14 0 0 1 14-14m0-20a34 34 0 1 0 34 34 34 34 0 0 0-34-34z"
|
|
|
- :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
|
|
|
|
|
- ></path>
|
|
|
|
|
|
|
+ :fill="contrlState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"></path>
|
|
|
</svg>
|
|
</svg>
|
|
|
<!-- 音频 -->
|
|
<!-- 音频 -->
|
|
|
- <Record />
|
|
|
|
|
|
|
+ <Record @callBack="sendAudio" :audioState="audioState" />
|
|
|
<!-- 信号 -->
|
|
<!-- 信号 -->
|
|
|
<Signal :signalValue="4" />
|
|
<Signal :signalValue="4" />
|
|
|
<!-- 电量 -->
|
|
<!-- 电量 -->
|
|
@@ -62,11 +52,12 @@ export default {
|
|
|
socket: null,
|
|
socket: null,
|
|
|
HOST: "wss://car.caner.top",
|
|
HOST: "wss://car.caner.top",
|
|
|
Peer: null,
|
|
Peer: null,
|
|
|
- isLogin: false,
|
|
|
|
|
|
|
+ isLogin: true,
|
|
|
error: "",
|
|
error: "",
|
|
|
remoteVideo: null,
|
|
remoteVideo: null,
|
|
|
- showLoading: true,
|
|
|
|
|
|
|
+ showLoading: false,
|
|
|
contrlState: false,
|
|
contrlState: false,
|
|
|
|
|
+ audioState: false,
|
|
|
speed: 1, //1低速档 | 2 高速档
|
|
speed: 1, //1低速档 | 2 高速档
|
|
|
iceServers: [
|
|
iceServers: [
|
|
|
{
|
|
{
|
|
@@ -176,8 +167,8 @@ export default {
|
|
|
// 挡位选择AB
|
|
// 挡位选择AB
|
|
|
if (db.buttons[1].touched) this.speed = 2;
|
|
if (db.buttons[1].touched) this.speed = 2;
|
|
|
if (db.buttons[0].touched) this.speed = 1;
|
|
if (db.buttons[0].touched) this.speed = 1;
|
|
|
- // 语音按键
|
|
|
|
|
- if (db.buttons[7].touched) console.log("R2");
|
|
|
|
|
|
|
+ // 语音按键R2
|
|
|
|
|
+ this.audioState = db.buttons[7].touched
|
|
|
const params = {
|
|
const params = {
|
|
|
v0: Math.floor(db.axes[0] * 128 + 128),
|
|
v0: Math.floor(db.axes[0] * 128 + 128),
|
|
|
v1: Math.floor(db.axes[1] * 128 + 128),
|
|
v1: Math.floor(db.axes[1] * 128 + 128),
|
|
@@ -191,6 +182,15 @@ export default {
|
|
|
requestAnimationFrame(this.ControlData);
|
|
requestAnimationFrame(this.ControlData);
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
|
|
+ // 发送语音
|
|
|
|
|
+ sendAudio(blob) {
|
|
|
|
|
+ if (!this.socket && !this.socket.connected) return;
|
|
|
|
|
+ this.socket.emit("msg", {
|
|
|
|
|
+ type: "Meadia",
|
|
|
|
|
+ Meadia: blob,
|
|
|
|
|
+ });
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
// 挡位
|
|
// 挡位
|
|
|
Gear(speed, num) {
|
|
Gear(speed, num) {
|
|
|
// 低速档
|
|
// 低速档
|
|
@@ -256,8 +256,6 @@ export default {
|
|
|
},
|
|
},
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- window.addEventListener("gamepadconnected", this.conControl);
|
|
|
|
|
- window.addEventListener("gamepaddisconnected", this.disControl);
|
|
|
|
|
this.intSoketRtc(this.HOST);
|
|
this.intSoketRtc(this.HOST);
|
|
|
},
|
|
},
|
|
|
destroyed() {
|
|
destroyed() {
|
|
@@ -286,6 +284,7 @@ video {
|
|
|
object-fit: fill;
|
|
object-fit: fill;
|
|
|
font-size: 0;
|
|
font-size: 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.marke {
|
|
.marke {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
|
top: 0;
|
|
top: 0;
|
|
@@ -298,6 +297,7 @@ video {
|
|
|
align-items: center;
|
|
align-items: center;
|
|
|
justify-content: center;
|
|
justify-content: center;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.marke::before {
|
|
.marke::before {
|
|
|
position: absolute;
|
|
position: absolute;
|
|
|
z-index: 0;
|
|
z-index: 0;
|
|
@@ -308,9 +308,11 @@ video {
|
|
|
border-left: 15px solid transparent;
|
|
border-left: 15px solid transparent;
|
|
|
border-right: 15px solid transparent;
|
|
border-right: 15px solid transparent;
|
|
|
}
|
|
}
|
|
|
-.marke > div {
|
|
|
|
|
|
|
+
|
|
|
|
|
+.marke>div {
|
|
|
margin: 0 3px;
|
|
margin: 0 3px;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
.gauge {
|
|
.gauge {
|
|
|
position: fixed;
|
|
position: fixed;
|
|
|
bottom: 0;
|
|
bottom: 0;
|
|
@@ -320,6 +322,7 @@ video {
|
|
|
height: 185px;
|
|
height: 185px;
|
|
|
z-index: 9;
|
|
z-index: 9;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/* 隐藏滚动条 */
|
|
/* 隐藏滚动条 */
|
|
|
::-webkit-scrollbar {
|
|
::-webkit-scrollbar {
|
|
|
width: 0 !important;
|
|
width: 0 !important;
|