npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@cf-platform/chat

v1.0.0

Published

聊天相关库

Readme

@cf-platform/chat

LiveKit

1. 初始化参数 LiveKitOptions

| 参数名 | 描述 | 类型 | 取值 | |--------------------|-------------------|---------------|------------| | wsUrl | 地址 | string | * | | log | 是否启用日志 | boolean | false | | e2ee | 是否使用e2ee加密 | boolean | false | | cryptoKey | 加密密钥 | string | password | | accordion | 手风琴模式(每次只能进入一个房间) | boolean | false | | forceUseTURN | 是否强制使用TURN服务 | boolean | false | | roomOptions | 房间选项 | RoomOptions | - | | RoomConnectOptions | 房间连接选项 | RoomOptions | - |

2. 房间选项 RoomOptions

interface RoomOptions {
  /** 
   * 自动管理订阅视频轨道的质量
   * @defaultValue `false`
   */
  adaptiveStream?: boolean

  /**
   * 捕获用户音频时使用的默认选项
   * @example
   * autoGainControl - 自动增益控制 
   * channelCount - 通道数或通道数范围
   * deviceId - 设备ID或ID数组
   * echoCancellation - 回音消除
   * latency - 可接受的延迟时间或延迟时间范围
   * noiseSuppression - 噪声抑制
   * processor - 用给定的处理器初始化轨道
   * sampleRate - 可接受的采样率或采样率范围
   * sampleSize - 可接受的采样大小或采样大小范围
   * @defaultValue `{ autoGainControl: true, echoCancellation: true, noiseSuppression: true }`
   */
  audioCaptureDefaults?: {
    autoGainControl?: ConstrainBoolean
    channelCount?: ConstrainULong
    deviceId?: ConstrainDOMString
    echoCancellation?: ConstrainBoolea
    latency?: ConstrainDouble
    noiseSuppression?: ConstrainBoolean
    processor?: TrackProcessor<Audio, AudioProcessorOptions>
    sampleRate?: ConstrainULong
    sampleSize?: ConstrainULong
  }

  /**
   * 房间音频输出
   * @params deviceId - 可设置音频输出设备
   */
  audioOutput?: {
    deviceId?: string
  }

  /** 
   * 离开页面时断开连接
   * @defaultValue `true`
   */
  disconnectOnPageLeave?: boolean

  /** 
   * 动态播出
   * @defaultValue `false`
   * @remarks 可以动态暂停任何订阅者未使用的视频层,从而显着减少发布 CPU 和带宽的使用。如果使用 SVC 编解码器 (VP9/AV1),将启用 dynacast。多编解码器联播需要 dynacast */
  dynacast?: boolean

  e2ee?: {
    keyProvider: BaseKeyProvider
    worker: Worker
  }

  /** 日志记录名称 */
  loggerName?: string

  /** 
   * 发布轨道时使用的默认选项
   * @example
   * audioPreset - 音频预设
   * backupCodec - 备份编解码器
   * degradationPreference - 退化偏好
   * dtx - 不连续音频传输
   * forceStereo - 以立体声模式发布轨道
   * red - 冗余音频数据
   * scalabilityMode - svc 编解码器的可扩展性模式,默认为“L3T3”
   * screenShareEncoding - 屏幕共享轨道的编码参数
   * screenShareSimulcastLayers - 用于屏幕轨道的自定义视频联播图层
   * simulcast - 使用联播,默认为 true
   * stopMicTrackOnMute - 停止麦克风音轨静音
   * videoCodec - 编解码器,默认为 vp8
   * videoEncoding - 视频编码
   * videoSimulcastLayers - 视频联播层
   * @default `{ audioPreset: AudioPresets.music, backupCodec: true, dtx: true, forceStereo: false, red: true, simulcast: true, screenShareEncoding: ScreenSharePresets.h1080fps15.encoding, stopMicTrackOnMute: false, videoCodec: 'vp8' }`
   */
  publishDefaults: {
    audioPreset?: AudioPreset
    backupCodec?: boolean | {
      codec: "vp8" | "h264"
      encoding?: VideoEncoding
    }
    degradationPreference?: RTCDegradationPreference
    dtx?: boolean
    forceStereo?: boolean
    red?: boolean
    scalabilityMode?: ScalabilityMode
    screenShareEncoding?: VideoEncoding
    screenShareSimulcastLayers?: VideoPreset[]
    simulcast?: boolean
    stopMicTrackOnMute?: boolean
    videoCodec?: "vp8" | "h264" | "vp9" | "av1"
    videoEncoding?: VideoEncoding
    videoSimulcastLayers?: VideoPreset[]
  }
  
  /** 尝试重新连接时使用的策略 */
  reconnectPolicy?: ReconnectPolicy

  /** 
   * 本地轨道在未发布时是否应停止
   * @defaultValue `true`
   * @remarks 如果希望手动清理未发布的本地轨道,则将其设置为 false 
   */
  stopLocalTrackOnUnpublish?: boolean
  
  /**
   * 捕获用户视频时使用的默认选项
   * @example
   * deviceId - 设备ID或ID数组
   * facingMode - 面向模式
   * processor - 用给定的处理器初始化轨道
   * resolution - 视频分辨率
   * @defaultValue `resolution: VideoPresets.h720.resolution`
   */
  videoCaptureDefaults: {
    deviceId?: ConstrainDOMString
    facingMode?: "user" | "environment" | "left" | "right"
    processor?: TrackProcessor<Video, VideoProcessorOptions>
    resolution?: VideoResolution
  }

  /** 
   * 混合网络音频中的所有音轨
   * @defaultValue `true`
   * @remarks 有助于解决一些音频自动播放问题,也允许传入自己的 AudioContext 实例
   */
  webAudioMix?: boolean | { audioContext: AudioContext }
}

3. 房间连接选项 RoomConnectOptions

interface RoomConnectOptions {
  /** 
   * 加入后自动订阅房间曲目
   * @defaultValue `true`
   */
  autoSubscribe?: boolean

  /** 
   * 最大重试次数
   * @defaultValue `1`
   */
  maxRetries?: number
  
  /**
   * 对等连接超时
   * @defaultValue `15`
   */
  peerConnectionTimeout?: number

  /** 用于覆盖 RTCConfiguration 配置 */
  rtcConfig?: RTCConfiguration

  /**
   * websocket连接超时
   * @defaultValue `15`
   */
  websocketTimeout?: number
}
export declare class LiveKit {
    /**
     * @param options 参数
     */
    constructor(options);
}