Browse Source

修复相关BUG

caner 1 year ago
parent
commit
c1a18d2ed4
4 changed files with 6 additions and 4 deletions
  1. 4 0
      src/App.vue
  2. 0 2
      src/pages/room/index.vue
  3. 1 1
      src/services/mqtt.service.ts
  4. 1 1
      src/services/webrtc.service.ts

+ 4 - 0
src/App.vue

@@ -33,6 +33,10 @@ watch(() => store.mqtt_message, (val) => {
     store.setLoading(true)
     store.setLoading(true)
     router.push('/room')
     router.push('/room')
   }
   }
+  if (val.type === 'WebRtcConnected') {
+    store.setLoading(false)
+    store.setRtcConnected(true)
+  }
   // mqtt ERROR
   // mqtt ERROR
   if (store.errorDic[val.type]) {
   if (store.errorDic[val.type]) {
     store.setLoading(false)
     store.setLoading(false)

+ 0 - 2
src/pages/room/index.vue

@@ -59,8 +59,6 @@ const gauge = ref({ speed: 0, num: 0 })
 
 
 watch(() => store.mqtt_message, async (value: { type: string, data?: RTCSessionDescriptionInit }) => {
 watch(() => store.mqtt_message, async (value: { type: string, data?: RTCSessionDescriptionInit }) => {
   const { type, data } = value
   const { type, data } = value
-  console.log('二级监听', value)
-
   // 接收远程offer
   // 接收远程offer
   if (type === 'offer') {
   if (type === 'offer') {
     console.log('offer', data)
     console.log('offer', data)

+ 1 - 1
src/services/mqtt.service.ts

@@ -43,7 +43,7 @@ export default class MqttService {
    * @returns
    * @returns
    */
    */
   async send(params: string, qos = 0) {
   async send(params: string, qos = 0) {
-    console.log('发送', this.client_channel, this.mqtt_id)
+    console.log('发送', this.client_channel, this.mqtt_id, params)
     if (!this.client_channel || !this.mqtt_id) return null
     if (!this.client_channel || !this.mqtt_id) return null
     return await publish(this.mqtt_id, this.client_channel, qos, false, params)
     return await publish(this.mqtt_id, this.client_channel, qos, false, params)
   }
   }

+ 1 - 1
src/services/webrtc.service.ts

@@ -45,7 +45,7 @@ export default class WebRtcService {
       this.Peer.ontrack = (evt) => {
       this.Peer.ontrack = (evt) => {
         console.log('track', evt)
         console.log('track', evt)
         DOM.srcObject = evt.streams[0]
         DOM.srcObject = evt.streams[0]
-        if (evt.type === 'audio') this.audioTack = evt.track
+        if (evt.track.kind === 'audio') this.audioTack = evt.track
       }
       }
 
 
       // listen changestate·
       // listen changestate·