Browse Source

Signed-off-by: caner <5658514@qq.com>

caner 3 years ago
parent
commit
2dba8e8b5b
2 changed files with 33 additions and 11 deletions
  1. 1 1
      README.md
  2. 32 10
      src/App.vue

+ 1 - 1
README.md

@@ -22,5 +22,5 @@
 4. A键是2档
 5. B键是1档
 6. R2是语音(按住说话)
-7. R3是静音
+7. L2是静音
 ```

+ 32 - 10
src/App.vue

@@ -24,25 +24,25 @@
         <Record @callBack="sendAudio" :audioState="audioState" />
         <!-- 喇叭 -->
         <svg viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="30" height="30">
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M393.707231 292.571429L343.13933 487.619048l46.955908 234.779541-97.523809-45.149912-66.82187-108.359788-21.671958-86.687831 66.82187-113.777778z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M451.499118 509.291005a104.747795 61.40388 90 1 0 122.80776 0 104.747795 61.40388 90 1 0-122.80776 0Z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M426.215168 781.996473c-3.611993 0-7.223986-1.805996-10.835979-3.611993l-117.389771-86.687831c-36.119929-23.477954-65.015873-57.791887-83.075838-99.329806-10.835979-25.283951-16.253968-52.373898-16.253968-81.269841s5.417989-55.985891 16.253968-81.269842c16.253968-41.537919 45.149912-74.045855 83.075838-97.523809l110.165785-77.657848c9.029982-5.417989 19.865961-3.611993 25.28395 3.611993 5.417989 9.029982 3.611993 19.865961-3.611993 25.28395L319.661376 361.199295c-32.507937 19.865961-55.985891 48.761905-70.433863 81.269841-9.029982 21.671958-14.447972 45.149912-14.447972 68.627866 0 23.477954 3.611993 45.149912 12.641976 66.821869 14.447972 34.313933 37.925926 63.209877 68.627866 83.075838l117.38977 86.687831c7.223986 5.417989 9.029982 18.059965 3.611993 25.28395 0 5.417989-5.417989 9.029982-10.835978 9.029983z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M523.738977 830.758377c-108.359788 0-193.241623-140.867725-193.241623-317.855379S415.379189 193.241623 523.738977 193.241623c25.283951 0 50.567901 7.223986 74.045855 23.477954 9.029982 5.417989 10.835979 16.253968 5.41799 25.28395s-16.253968 10.835979-25.283951 5.41799c-18.059965-10.835979-34.313933-18.059965-54.179894-18.059965-84.881834 0-157.121693 130.031746-157.121693 281.73545S438.857143 794.638448 523.738977 794.638448s157.121693-130.031746 157.121693-281.73545c0-74.045855-16.253968-146.285714-46.955908-198.659612-5.417989-9.029982-1.805996-19.865961 7.223986-25.28395 9.029982-5.417989 19.865961-1.805996 25.28395 7.223986 32.507937 59.597884 50.567901 135.449735 50.567902 216.719576C718.786596 689.890653 633.904762 830.758377 523.738977 830.758377z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M523.738977 646.546737c-48.761905 0-86.687831-59.597884-86.687831-133.643739S474.977072 379.259259 523.738977 379.259259s86.687831 59.597884 86.687831 133.643739-37.925926 133.643739-86.687831 133.643739z m0-232.973545c-23.477954 0-50.567901 39.731922-50.567901 97.52381s27.089947 97.52381 50.567901 97.523809 50.567901-39.731922 50.567901-97.523809-27.089947-97.52381-50.567901-97.52381z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M523.738977 413.573192h-1.805996l-92.105821-10.835979c-9.029982-1.805996-16.253968-10.835979-16.253968-19.865961 1.805996-9.029982 10.835979-16.253968 19.865961-16.253968l92.105821 10.835979c9.029982 1.805996 16.253968 10.835979 16.253968 19.865961 0 9.029982-9.029982 16.253968-18.059965 16.253968zM372.035273 662.800705c-9.029982 0-16.253968-7.223986-18.059964-16.253968-1.805996-9.029982 5.417989-18.059965 16.253968-19.865961l153.5097-16.253968c9.029982-1.805996 18.059965 5.417989 19.865961 16.253968 1.805996 9.029982-5.417989 18.059965-16.253968 19.865961l-153.5097 16.253968h-1.805997z">
           </path>
-          <path :fill="mutedState ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
+          <path :fill="muted ? '#00CED1' : 'rgba(0, 0, 0, 0.3)'"
             d="M763.936508 364.811287c-5.417989 0-9.029982-1.805996-12.641975-5.417989-7.223986-7.223986-7.223986-18.059965 0-25.283951l25.28395-25.28395c7.223986-7.223986 18.059965-7.223986 25.283951 0s7.223986 18.059965 0 25.28395L776.578483 359.393298c-3.611993 3.611993-9.029982 5.417989-12.641975 5.417989zM771.160494 720.592593c-5.417989 0-9.029982-1.805996-12.641975-5.41799l-25.283951-25.28395c-7.223986-7.223986-7.223986-18.059965 0-25.283951s18.059965-7.223986 25.283951 0l25.28395 25.283951c7.223986 7.223986 7.223986 18.059965 0 25.28395-3.611993 3.611993-7.223986 5.417989-12.641975 5.41799zM819.922399 529.156966h-54.179895c-10.835979 0-18.059965-7.223986-18.059964-18.059964s7.223986-18.059965 18.059964-18.059965h54.179895c10.835979 0 18.059965 7.223986 18.059964 18.059965s-9.029982 18.059965-18.059964 18.059964z">
           </path>
         </svg>
@@ -83,8 +83,10 @@ export default {
       showLoading: true,
       contrlState: false,
       audioState: false,
+      mutedState: true,
       speed: 1, //1低速档 | 2 高速档
-      mutedState: true,// 是否静音
+      muted: true,// 是否静音
+      audioPlay:false,
       signalValue: 0,
       SpeedValue: 0,
       iceServers: [
@@ -97,6 +99,8 @@ export default {
           credential: "123456",
         },
       ],
+      num: 0,
+      num2:0
     };
   },
   methods: {
@@ -199,8 +203,11 @@ export default {
       if (db.buttons[0].touched) this.speed = 1;
       // 语音按键R2
       this.audioState = db.buttons[7].touched
-      // 静音
-      this.mutedState = !db.buttons[8].touched
+      // 静音L2
+      this.mutedState = db.buttons[6].touched
+      // 播放警笛X3
+
+      console.log(db.buttons);
       const params = {
         v0: Math.floor(db.axes[0] * 128 + 128),
         v1: Math.floor(db.axes[1] * 128 + 128),
@@ -223,6 +230,11 @@ export default {
       });
     },
 
+    // 鸣笛
+    playWarningAudio(){
+
+    },
+
     // 挡位
     Gear(speed, num) {
       // 低速档
@@ -289,6 +301,16 @@ export default {
   },
   mounted() {
     this.intSoketRtc(this.HOST);
+  },
+  watch: {
+    // 静音
+    mutedState(v) {
+      if (v) this.num++
+      if (!this.remoteVideo) return
+      const state = this.num % 2 ? false : true
+      this.remoteVideo.muted = state
+      this.muted = state
+    }
   }
 };
 </script>