mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-07 02:46:55 +08:00
fix open live danmaku client init
This commit is contained in:
@@ -18,7 +18,7 @@ export default class OpenLiveClient extends BaseDanmakuClient {
|
||||
private timer: any | undefined
|
||||
|
||||
public authInfo: AuthInfo | undefined
|
||||
public roomAuthInfo: RoomAuthInfo | undefined
|
||||
public roomAuthInfo: OpenLiveInfo | undefined
|
||||
public authCode: string | undefined
|
||||
|
||||
public events: {
|
||||
@@ -71,6 +71,8 @@ export default class OpenLiveClient extends BaseDanmakuClient {
|
||||
)
|
||||
})
|
||||
|
||||
this.roomAuthInfo = auth.data
|
||||
|
||||
return await super.initClientInner(chatClient)
|
||||
} else {
|
||||
console.log(`[${this.type}] 无法开启场次: ` + auth.message)
|
||||
@@ -369,66 +371,6 @@ export interface AuthInfo {
|
||||
Caller: string
|
||||
CodeSign: string
|
||||
}
|
||||
/**
|
||||
* 场次信息
|
||||
*/
|
||||
interface GameInfo {
|
||||
/**
|
||||
* 场次id,心跳key(心跳保持20s-60s)调用一次,超过60s无心跳自动关闭,长连停止推送消息
|
||||
*/
|
||||
game_id: string
|
||||
}
|
||||
|
||||
/**
|
||||
* 长连信息
|
||||
*/
|
||||
interface WebsocketInfo {
|
||||
/**
|
||||
* 长连使用的请求json体 第三方无需关注内容,建立长连时使用即可
|
||||
*/
|
||||
auth_body: string
|
||||
/**
|
||||
* wss 长连地址
|
||||
*/
|
||||
wss_link: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 主播信息
|
||||
*/
|
||||
interface AnchorInfo {
|
||||
/**
|
||||
* 主播房间号
|
||||
*/
|
||||
room_id: number
|
||||
/**
|
||||
* 主播昵称
|
||||
*/
|
||||
uname: string
|
||||
/**
|
||||
* 主播头像
|
||||
*/
|
||||
uface: string
|
||||
/**
|
||||
* 主播uid
|
||||
*/
|
||||
uid: number
|
||||
open_id: string
|
||||
}
|
||||
export interface RoomAuthInfo {
|
||||
/**
|
||||
* 场次信息
|
||||
*/
|
||||
game_info: GameInfo
|
||||
/**
|
||||
* 长连信息
|
||||
*/
|
||||
websocket_info: WebsocketInfo
|
||||
/**
|
||||
* 主播信息
|
||||
*/
|
||||
anchor_info: AnchorInfo
|
||||
}
|
||||
export interface DanmakuEventsMap {
|
||||
danmaku: (arg1: DanmakuInfo, arg2?: any) => void
|
||||
gift: (arg1: GiftInfo, arg2?: any) => void
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { useAccount } from '@/api/account'
|
||||
import OpenLiveClient, {
|
||||
AuthInfo,
|
||||
RoomAuthInfo
|
||||
} from '@/data/DanmakuClients/OpenLiveClient'
|
||||
import { OpenLiveInfo } from '@/api/api-models'
|
||||
import OpenLiveClient, { AuthInfo } from '@/data/DanmakuClients/OpenLiveClient'
|
||||
import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
@@ -21,7 +19,7 @@ export const useDanmakuClient = defineStore('DanmakuClient', () => {
|
||||
const connected = computed(
|
||||
() => status.value === 'running' || status.value === 'listening'
|
||||
)
|
||||
const authInfo = ref<RoomAuthInfo>()
|
||||
const authInfo = ref<OpenLiveInfo>()
|
||||
const accountInfo = useAccount()
|
||||
|
||||
let existOtherClient = false
|
||||
|
||||
@@ -200,6 +200,8 @@ onUnmounted(() => {
|
||||
</KeepAlive>
|
||||
</RouterView>
|
||||
<template v-else>
|
||||
|
||||
{{ }}
|
||||
<NAlert type="info" title="正在请求弹幕客户端认证信息...">
|
||||
<NSpin show />
|
||||
</NAlert>
|
||||
|
||||
Reference in New Issue
Block a user