This commit is contained in:
2024-11-25 17:11:24 +08:00
parent 13b788361b
commit c09085099d
2 changed files with 4 additions and 2 deletions

View File

@@ -71,9 +71,9 @@ export abstract class BaseRTCClient {
secure: true,
config: {
iceServers: [
{ urls: 'stun:turn.suki.club' },
{ url: 'stun:turn.suki.club' },
{
urls: 'turn:turn.suki.club',
url: 'turn:turn.suki.club',
username: this.user,
credential: this.pass
}
@@ -172,6 +172,7 @@ export class SlaveRTCClient extends BaseRTCClient {
id
)
})
c?.on('error', (err) => console.error(err))
c?.on('data', (data) => this.processData(c, data as RTCData))
c?.on('close', () => this.onConnectionClose(c.peer))
}

View File

@@ -78,6 +78,7 @@ export const useDanmakuClient = defineStore('DanmakuClient', () => {
if (lock) {
status.value = 'initializing'
bc = new BroadcastChannel('vtsuru.danmaku.' + accountInfo.value?.id)
console.log('[DanmakuClient] 创建 BroadcastChannel: ' + bc.name)
bc.onmessage = (event) => {
const message: BCMessage = event.data as BCMessage
const data = message.data ? JSON.parse(message.data) : {}