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

View File

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