@@ -33,6 +33,10 @@ watch(() => store.mqtt_message, (val) => {
store.setLoading(true)
router.push('/room')
}
+ if (val.type === 'WebRtcConnected') {
+ store.setLoading(false)
+ store.setRtcConnected(true)
+ }
// mqtt ERROR
if (store.errorDic[val.type]) {
store.setLoading(false)
@@ -59,8 +59,6 @@ const gauge = ref({ speed: 0, num: 0 })
watch(() => store.mqtt_message, async (value: { type: string, data?: RTCSessionDescriptionInit }) => {
const { type, data } = value
- console.log('二级监听', value)
-
// 接收远程offer
if (type === 'offer') {
console.log('offer', data)
@@ -43,7 +43,7 @@ export default class MqttService {
* @returns
*/
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
return await publish(this.mqtt_id, this.client_channel, qos, false, params)
@@ -45,7 +45,7 @@ export default class WebRtcService {
this.Peer.ontrack = (evt) => {
console.log('track', evt)
DOM.srcObject = evt.streams[0]
- if (evt.type === 'audio') this.audioTack = evt.track
+ if (evt.track.kind === 'audio') this.audioTack = evt.track
// listen changestate·