Options
All
  • Public
  • Public/Protected
  • All
Menu

如视 Live SDK

Index

Type Aliases

BuiltinMsg: { action: BuiltinActionType; data: { extension?: Record<string, any> }; event_type: BuiltinEventType; to_user_ids: string[] }

内置事件数据结构体。

Type declaration

  • action: BuiltinActionType
  • data: { extension?: Record<string, any> }
    • [key: string]: any
    • Optional extension?: Record<string, any>
  • event_type: BuiltinEventType
  • to_user_ids: string[]
EventType<KeyframesSnapshot>: LiveEventType<KeyframesSnapshot>

事件解析

Type Parameters

  • KeyframesSnapshot

GetVoiceSign: (({ voiceId, userId, roomId, }: { roomId: string | number; userId: string; voiceId: string }) => Promise<GetVoiceSignReturnType>)

Type declaration

    • ({ voiceId, userId, roomId, }: { roomId: string | number; userId: string; voiceId: string }): Promise<GetVoiceSignReturnType>
    • 获取用户语音签名

      Parameters

      • { voiceId, userId, roomId, }: { roomId: string | number; userId: string; voiceId: string }
        • roomId: string | number
        • userId: string
        • voiceId: string

      Returns Promise<GetVoiceSignReturnType>

KeyframeTypes<Type>: { [ Property in keyof Type as Property]: ((nextKeyframes: Type[Property], prevKeyframes: Type[Property], frontRequestId: string) => void) }

帧数据类型

Type Parameters

  • Type

LiveConnectOptions: { force?: boolean; rtcMicStatus?: MicroStatus; url?: string; getTicket?: any }

Type declaration

  • Optional force?: boolean
  • Optional rtcMicStatus?: MicroStatus
  • Optional url?: string
  • getTicket?:function
    • getTicket(): Promise<string>
    • Returns Promise<string>

LiveEventType<KeyframesSnapshot>: { broadcast: any; builtinEvent: any; error: any; keyframes: any; kickOut: any; readyKeyframeSync: any; roomChange: any; selfInfoUpdate: any; stateChange: any; userChange: any; userListUpdate: any }

带看事件列表

Type Parameters

  • KeyframesSnapshot

Type declaration

  • broadcast:function
    • broadcast(evtMsg: Record<string, any>, frontRequestId: string): void
    • 收到其他用户的广播消息。

      Parameters

      • evtMsg: Record<string, any>
      • frontRequestId: string

      Returns void

  • builtinEvent:function
    • 内置消息事件

      Parameters

      Returns void

  • error:function
    • 异常消息:不符合规范。

      Parameters

      Returns void

  • keyframes:function
    • keyframes(keyframes: Partial<KeyframesSnapshot>, frontRequestId: string): void
    • 获取其他用户输送的帧数据:根据此帧数据更新UI状态。

      Parameters

      • keyframes: Partial<KeyframesSnapshot>
      • frontRequestId: string

      Returns void

  • kickOut:function
    • kickOut(): void
    • 被踢出房间

      Returns void

  • readyKeyframeSync:function
    • readyKeyframeSync(lastKeyframe: Partial<KeyframesSnapshot>): void
    • 带看已经就绪,可以发送帧数据。

      Parameters

      • lastKeyframe: Partial<KeyframesSnapshot>

        带看最后一帧数据(链接切换、断网等重连恢复上次会话帧状态),你可以通过此数据拉齐当前UI状态。

      Returns void

  • roomChange:function
    • 内置消息事件:房间信息改变

      Parameters

      Returns void

  • selfInfoUpdate:function
    • selfInfoUpdate(userInfo: UserInfo, frontRequestId: string): void
    • 个人信息发生更新。

      Parameters

      • userInfo: UserInfo
      • frontRequestId: string

      Returns void

  • stateChange:function
    • 带看状态变化

      Parameters

      Returns void

  • userChange:function
    • 内置消息事件: 用户信息改变

      Parameters

      Returns void

  • userListUpdate:function
    • userListUpdate(userList: UserInfo[], frontRequestId: string): void
    • 用户列表更新。

      Parameters

      • userList: UserInfo[]
      • frontRequestId: string

      Returns void

LiveMsg: { appId: string; code: string; command: Command; data: Record<string, any> | Record<string, any>[]; frontRequestId: string; message: string; requestId: string; roomCode: string; triggerUserId: string }

响应的信息结构体。

Type declaration

  • appId: string
  • code: string
  • command: Command
  • data: Record<string, any> | Record<string, any>[]
  • frontRequestId: string
  • message: string
  • requestId: string
  • roomCode: string
  • triggerUserId: string
LiveProviderPropTypes<KeyframesSnapshot>: { children?: React.ReactNode; live?: Live<KeyframesSnapshot> }

Type Parameters

  • KeyframesSnapshot

Type declaration

  • Optional children?: React.ReactNode
  • Optional live?: Live<KeyframesSnapshot>
RTCActionReactCallback: Pick<RTCProtocol, "join" | "quit" | "shock" | "toggleMicro" | "detectMicro">
RTCEventType: { error: any; joinWillStart: any; joined: any; userVolumes: any; weakNetwork: any }

RTC 异步事件类型。

Type declaration

  • error:function
    • 错误\异常

      Parameters

      Returns void

  • joinWillStart:function
    • joinWillStart(): void
    • 即将加入房间。

      Returns void

  • joined:function
    • joined(): void
    • 成功加入语音房间。

      Returns void

  • userVolumes:function
    • 每个用户的音量。

      Parameters

      Returns void

  • weakNetwork:function
    • weakNetwork(): void
    • 弱网提醒事件。

      Returns void

ReqLiveMsg: { command: Command; data: { to_user_ids?: string[] }; front_request_id: string }

向服务端请求数据时的数据格式。

Type declaration

  • command: Command

    请求指令。

  • data: { to_user_ids?: string[] }

    数据内容

    • [key: string]: any
    • Optional to_user_ids?: string[]

      如果此数据仅发送给某些用户,请提供这些用户的ucid。

  • front_request_id: string

    前端请求时生成的uuid()。

RoomInfo: { info: { app_id: string; create_time: string; create_user_id: string; extension: Record<string, any>; id: string | number; room_code: string; status: string | number }; init_timestamp: string; last_frame: Record<string, any> }

Type declaration

  • info: { app_id: string; create_time: string; create_user_id: string; extension: Record<string, any>; id: string | number; room_code: string; status: string | number }
    • app_id: string
    • create_time: string
    • create_user_id: string
    • extension: Record<string, any>
    • id: string | number
    • room_code: string
    • status: string | number
  • init_timestamp: string
  • last_frame: Record<string, any>
UserInfo: { current_ws_online?: boolean; extension?: UserInfoExt; id: string; mem_user_status?: MemUserStatus; micro_status: boolean; once_ws_online?: boolean; permission?: Record<string, boolean>; rtc: boolean; status?: UserStatus; user_role?: number | string }

带看会话房间用户的信息格式。

Type declaration

  • Optional current_ws_online?: boolean

    用户当前是否在线。

  • Optional extension?: UserInfoExt

    用户信息扩展字段。

  • id: string

    用户唯一标识ID。

  • Optional mem_user_status?: MemUserStatus

    内存中的用户状态。

  • micro_status: boolean

    用户当前是否开启麦克风。

  • Optional once_ws_online?: boolean

    用户曾经是否在线过,即进入房间后又由于某种原因离开后重新进入。

  • Optional permission?: Record<string, boolean>

    当前用户的权限配置。(UI层面理解)。

  • rtc: boolean

    RTC 环境是否就绪,即当前语音是否联通。

  • Optional status?: UserStatus

    用户当前的状态。

  • Optional user_role?: number | string

    用户角色定义。(前端不关注此字段)。

UserInfoExt: { avatar?: string; nickname?: string }

用户信息扩展字段:比如提供用户画像相关的数据。

Type declaration

  • [key: string]: any

    其他用户相关的字段,比如用户职称、住址、联系方式等信息。

  • Optional avatar?: string

    用户头像。

  • Optional nickname?: string

    用户昵称。

UserVolume: { audioVolume: number; userId: string }

用户的音量信息。

Type declaration

  • audioVolume: number
  • userId: string
WebSocketError: { closeError?: WebSocketCloseError; error?: any; target?: Event | CloseEvent; type: WebSocketErrorType }

Type declaration

Functions

  • createLive<KeyframesSnapshot>(opts: LiveOptions): Live<KeyframesSnapshot>
  • 创建Live实例

    Type Parameters

    • KeyframesSnapshot

    Parameters

    Returns Live<KeyframesSnapshot>

  • createLiveReact<KeyframesSnapshot>(options: LiveOptions): { LiveProvider: ((props: LiveProviderPropTypes<KeyframesSnapshot>) => Element); jsBridge: JSBridgeProtocol; live: Live<KeyframesSnapshot>; unsafe__useLiveInstance: (() => Live<KeyframesSnapshot>); unsafe__useRTCInstance: (() => RTCProtocol); useConnect: (() => ((options: LiveConnectOptions) => Promise<boolean | Error>)); useKeyframe: (<K>(key: K) => CallbackType); useKeyframeUpdateCallback: (<KeyOfKeyframe>(key: KeyOfKeyframe, callback: ((...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>), deps?: DependencyList) => (() => void)); useKeyframesSnapshot: (() => Partial<KeyframesSnapshot>); useLiveAction: (() => { broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>); connect: ((options: LiveConnectOptions) => Promise<boolean | Error>); exit: (() => Promise<boolean>); forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>); forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>); getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]); kick: ((toUserIds: string | string[]) => Promise<boolean>); sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error); setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>); toggleMicro: ((microStatus: boolean) => Promise<boolean>); updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>) }); useLiveEventCallback: (<K>(name: K, callback: ((...args: Parameters<LiveEventType<KeyframesSnapshot>[K]>) => ReturnType<LiveEventType<KeyframesSnapshot>[K]>), deps?: DependencyList) => (() => void)); useLiveState: (() => LiveState); useRTCAction: (() => { detectMicro: (() => Promise<boolean>); join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>); quit: (() => Promise<boolean>); shock: (() => undefined | void); toggleMicro: ((flag?: boolean) => Promise<boolean>) }); useRTCEventCallback: (<K>(name: K, callback: ((...args: Parameters<RTCEventType[K]>) => ReturnType<RTCEventType[K]>), deps?: DependencyList) => (() => void)); useSelfInfo: (() => CallbackType); useUserList: (() => UserInfo[]) }
  • 创建 {@link LiveReact} 实例,并提供 React 技术栈相关工具链。

    Type Parameters

    • KeyframesSnapshot

    Parameters

    Returns { LiveProvider: ((props: LiveProviderPropTypes<KeyframesSnapshot>) => Element); jsBridge: JSBridgeProtocol; live: Live<KeyframesSnapshot>; unsafe__useLiveInstance: (() => Live<KeyframesSnapshot>); unsafe__useRTCInstance: (() => RTCProtocol); useConnect: (() => ((options: LiveConnectOptions) => Promise<boolean | Error>)); useKeyframe: (<K>(key: K) => CallbackType); useKeyframeUpdateCallback: (<KeyOfKeyframe>(key: KeyOfKeyframe, callback: ((...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>), deps?: DependencyList) => (() => void)); useKeyframesSnapshot: (() => Partial<KeyframesSnapshot>); useLiveAction: (() => { broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>); connect: ((options: LiveConnectOptions) => Promise<boolean | Error>); exit: (() => Promise<boolean>); forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>); forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>); getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]); kick: ((toUserIds: string | string[]) => Promise<boolean>); sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error); setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>); toggleMicro: ((microStatus: boolean) => Promise<boolean>); updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>) }); useLiveEventCallback: (<K>(name: K, callback: ((...args: Parameters<LiveEventType<KeyframesSnapshot>[K]>) => ReturnType<LiveEventType<KeyframesSnapshot>[K]>), deps?: DependencyList) => (() => void)); useLiveState: (() => LiveState); useRTCAction: (() => { detectMicro: (() => Promise<boolean>); join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>); quit: (() => Promise<boolean>); shock: (() => undefined | void); toggleMicro: ((flag?: boolean) => Promise<boolean>) }); useRTCEventCallback: (<K>(name: K, callback: ((...args: Parameters<RTCEventType[K]>) => ReturnType<RTCEventType[K]>), deps?: DependencyList) => (() => void)); useSelfInfo: (() => CallbackType); useUserList: (() => UserInfo[]) }

    • LiveProvider: ((props: LiveProviderPropTypes<KeyframesSnapshot>) => Element)
    • jsBridge: JSBridgeProtocol
    • live: Live<KeyframesSnapshot>
    • unsafe__useLiveInstance: (() => Live<KeyframesSnapshot>)
        • (): Live<KeyframesSnapshot>
        • 不建议这样使用

          deprecated

          Returns Live<KeyframesSnapshot>

    • unsafe__useRTCInstance: (() => RTCProtocol)
    • useConnect: (() => ((options: LiveConnectOptions) => Promise<boolean | Error>))
    • useKeyframe: (<K>(key: K) => CallbackType)
        • <K>(key: K): CallbackType
        • Type Parameters

          • K extends string | number | symbol

          Parameters

          • key: K

          Returns CallbackType

    • useKeyframeUpdateCallback: (<KeyOfKeyframe>(key: KeyOfKeyframe, callback: ((...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>), deps?: DependencyList) => (() => void))
        • <KeyOfKeyframe>(key: KeyOfKeyframe, callback: ((...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>), deps?: DependencyList): (() => void)
        • Type Parameters

          • KeyOfKeyframe extends string | number | symbol

          Parameters

          • key: KeyOfKeyframe
          • callback: ((...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>) => ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>)
              • (...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>): ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>
              • Parameters

                • Rest ...args: Parameters<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>

                Returns ReturnType<KeyframeTypes<KeyframesSnapshot>[KeyOfKeyframe]>

          • deps: DependencyList = []

          Returns (() => void)

            • (): void
            • Returns void

    • useKeyframesSnapshot: (() => Partial<KeyframesSnapshot>)
        • (): Partial<KeyframesSnapshot>
        • Returns Partial<KeyframesSnapshot>

    • useLiveAction: (() => { broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>); connect: ((options: LiveConnectOptions) => Promise<boolean | Error>); exit: (() => Promise<boolean>); forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>); forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>); getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]); kick: ((toUserIds: string | string[]) => Promise<boolean>); sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error); setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>); toggleMicro: ((microStatus: boolean) => Promise<boolean>); updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>) })
        • (): { broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>); connect: ((options: LiveConnectOptions) => Promise<boolean | Error>); exit: (() => Promise<boolean>); forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>); forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>); getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]); kick: ((toUserIds: string | string[]) => Promise<boolean>); sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error); setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>); toggleMicro: ((microStatus: boolean) => Promise<boolean>); updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>) }
        • 带看的一些操作

          Returns { broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>); connect: ((options: LiveConnectOptions) => Promise<boolean | Error>); exit: (() => Promise<boolean>); forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>); forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>); getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]); kick: ((toUserIds: string | string[]) => Promise<boolean>); sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error); setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>); toggleMicro: ((microStatus: boolean) => Promise<boolean>); updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>) }

          • broadcast: ((data: Record<string, any>, toUserIds: string | string[], timeout?: number) => Promise<unknown>)
              • (data: Record<string, any>, toUserIds: string | string[], timeout?: number): Promise<unknown>
              • Parameters

                • data: Record<string, any>
                • toUserIds: string | string[]
                • timeout: number = 0

                Returns Promise<unknown>

          • connect: ((options: LiveConnectOptions) => Promise<boolean | Error>)
          • exit: (() => Promise<boolean>)
              • (): Promise<boolean>
              • Returns Promise<boolean>

          • forbidMicro: ((micro: MicroStatus, toUserIds?: string | string[]) => Promise<boolean>)
              • (micro: MicroStatus, toUserIds?: string | string[]): Promise<boolean>
              • Parameters

                Returns Promise<boolean>

          • forbidSync: ((sync: boolean, toUserIds?: string | string[]) => Promise<boolean>)
              • (sync: boolean, toUserIds?: string | string[]): Promise<boolean>
              • Parameters

                • sync: boolean
                • toUserIds: string | string[] = []

                Returns Promise<boolean>

          • getFramesByKey: ((key: keyof KeyframesSnapshot) => undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot])
              • (key: keyof KeyframesSnapshot): undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]
              • Parameters

                • key: keyof KeyframesSnapshot

                Returns undefined | Partial<KeyframesSnapshot>[keyof KeyframesSnapshot]

          • kick: ((toUserIds: string | string[]) => Promise<boolean>)
              • (toUserIds: string | string[]): Promise<boolean>
              • Parameters

                • toUserIds: string | string[]

                Returns Promise<boolean>

          • sendKeyframe: ((key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]) => boolean | Error)
              • (key: keyof KeyframesSnapshot, frame: KeyframesSnapshot[keyof KeyframesSnapshot]): boolean | Error
              • Parameters

                • key: keyof KeyframesSnapshot
                • frame: KeyframesSnapshot[keyof KeyframesSnapshot]

                Returns boolean | Error

          • setSelfInfo: ((userInfo: Partial<UserInfo>) => Promise<boolean>)
              • (userInfo: Partial<UserInfo>): Promise<boolean>
              • Parameters

                Returns Promise<boolean>

          • toggleMicro: ((microStatus: boolean) => Promise<boolean>)
              • (microStatus: boolean): Promise<boolean>
              • Parameters

                • microStatus: boolean

                Returns Promise<boolean>

          • updateStatus: ((evtType: BuiltinEventType, atnType: BuiltinActionType, status: Record<string, any>, toUserIds?: string | string[]) => Promise<boolean>)
    • useLiveEventCallback: (<K>(name: K, callback: ((...args: Parameters<LiveEventType<KeyframesSnapshot>[K]>) => ReturnType<LiveEventType<KeyframesSnapshot>[K]>), deps?: DependencyList) => (() => void))
        • <K>(name: K, callback: ((...args: Parameters<LiveEventType<KeyframesSnapshot>[K]>) => ReturnType<LiveEventType<KeyframesSnapshot>[K]>), deps?: DependencyList): (() => void)
        • Type Parameters

          Parameters

          Returns (() => void)

            • (): void
            • Returns void

    • useLiveState: (() => LiveState)
    • useRTCAction: (() => { detectMicro: (() => Promise<boolean>); join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>); quit: (() => Promise<boolean>); shock: (() => undefined | void); toggleMicro: ((flag?: boolean) => Promise<boolean>) })
        • (): { detectMicro: (() => Promise<boolean>); join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>); quit: (() => Promise<boolean>); shock: (() => undefined | void); toggleMicro: ((flag?: boolean) => Promise<boolean>) }
        • Returns { detectMicro: (() => Promise<boolean>); join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>); quit: (() => Promise<boolean>); shock: (() => undefined | void); toggleMicro: ((flag?: boolean) => Promise<boolean>) }

          • detectMicro: (() => Promise<boolean>)
              • (): Promise<boolean>
              • Returns Promise<boolean>

          • join: ((options: { roomId: string; type: RTCType; userId: string; voiceId: string }) => Promise<boolean>)
              • (options: { roomId: string; type: RTCType; userId: string; voiceId: string }): Promise<boolean>
              • Parameters

                • options: { roomId: string; type: RTCType; userId: string; voiceId: string }
                  • roomId: string
                  • type: RTCType
                  • userId: string
                  • voiceId: string

                Returns Promise<boolean>

          • quit: (() => Promise<boolean>)
              • (): Promise<boolean>
              • Returns Promise<boolean>

          • shock: (() => undefined | void)
              • (): undefined | void
              • Returns undefined | void

          • toggleMicro: ((flag?: boolean) => Promise<boolean>)
              • (flag?: boolean): Promise<boolean>
              • Parameters

                • Optional flag: boolean

                Returns Promise<boolean>

    • useRTCEventCallback: (<K>(name: K, callback: ((...args: Parameters<RTCEventType[K]>) => ReturnType<RTCEventType[K]>), deps?: DependencyList) => (() => void))
    • useSelfInfo: (() => CallbackType)
        • (): CallbackType
        • Returns CallbackType

    • useUserList: (() => UserInfo[])
  • parseLiveMsg(jsonTxt: string): LiveMsg | boolean
  • 解析下后端数据格式。

    Parameters

    • jsonTxt: string

      JSON序列化后的文本。

    Returns LiveMsg | boolean

    false 标识解析失败;解析成功返回 LiveMsg 实例。

  • parseWSClsErr(code: number): WebSocketCloseError
  • Parameters

    • code: number

    Returns WebSocketCloseError