|
|
@@ -47,6 +47,7 @@ onMounted(() => RTC.initRTC(remoteVideo.value, (event) => {
|
|
|
console.log('可以发送控制数据')
|
|
|
}
|
|
|
if (type === 'answer') {
|
|
|
+ console.log('answer', data)
|
|
|
mqtt.send(JSON.stringify(data))
|
|
|
}
|
|
|
if (type === 'disconnected') {
|
|
|
@@ -55,11 +56,11 @@ onMounted(() => RTC.initRTC(remoteVideo.value, (event) => {
|
|
|
}
|
|
|
}))
|
|
|
|
|
|
-watch(() => store.mqtt_message, async (val) => {
|
|
|
+watch(() => store.mqtt_message, async (val: { type: string, data?: RTCSessionDescriptionInit }) => {
|
|
|
// 接收offer
|
|
|
if (val.type === 'offer') {
|
|
|
console.log('offer', val)
|
|
|
- await RTC.Peer?.setRemoteDescription(val.data)
|
|
|
+ await RTC.Peer?.setRemoteDescription(val.data!)
|
|
|
const answerd = await RTC.Peer?.createAnswer()
|
|
|
await RTC.Peer?.setLocalDescription(answerd)
|
|
|
}
|