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

ueplayer

v2.0.3

Published

自定义 UE Pixel Streaming 播放器组件库。

Downloads

43

Readme

ueplayer

自定义 UE Pixel Streaming 播放器组件库。

该库依赖你的 UE / MatchMaker / 信令服务端实现,不是开箱即用的通用播放器。

1. 安装

pnpm add ueplayer
# or
npm i ueplayer
# or
yarn add ueplayer

包名:ueplayer

2. Peer Dependencies(必须由业务项目安装)

本库不会把以下依赖打进产物,需由使用方自行安装:

  • react>=18.2.0 <20
  • react-dom>=18.2.0 <20
  • lodash^4.17.21

如果未安装或版本不满足,包管理器会给出 peer warning,运行时也可能异常。

3. 使用方式

Vite / Webpack / Rspack 都按根入口使用即可:

import { Player, Resolutions, UePlayer, type CommonUeSendCommand } from 'ueplayer';

function onVideoReady(player: UePlayer) {
  player.emitUIInteraction({
    command: 'freezeFrame',
    params: null,
  });

  player.on('closeClient', (payload: CommonUeSendCommand['results']) => {
    console.log('closeClient', payload);
  });
}

export default function App() {
  return (
    <Player
      appName="haitai"
      resolution={Resolutions.auto}
      enableAudio
      afkTimeoutSeconds={180}
      videoReadyCallback={onVideoReady}
    />
  );
}

4. Player 参数

| 参数 | 类型 | 默认值 | 说明 | |---|---|---|---| | appName | string | - | 应用名称(必填) | | resolution | ResolutionConfig | auto | auto / 4k / 2k / 1080p / 720p | | enableAudio | boolean | false | 是否协商音频 | | afkTimeoutSeconds | number | 180 | 用户无操作超时断开(最小 60 秒,内部按 max(60, value) 处理) | | videoReadyCallback | (player: UePlayer) => void | undefined | 视频流就绪回调 | | className | string | '' | 容器额外类名 | | style | CSSProperties | undefined | 容器样式 |

5. 发布与版本管理

发布流程(npm)

  1. 更新版本号(建议使用 npm version patch|minor|major
  2. 构建并自测
  3. 发布:npm publishpnpm publish
  4. 使用方升级:pnpm up ueplayer / npm update ueplayer

版本策略建议

  • 遵循 SemVer:
    • patch:修复问题,不改 API
    • minor:新增兼容能力
    • major:不兼容变更
  • 每次发布必须是新版本号;同版本不能重复发布到 npm。
  • 若你同时维护 README / API,请保持与当前导出一致,避免示例失真。

6. 音频策略说明

  • enableAudio=false:前端不会协商音轨。
  • enableAudio=true:会协商音轨,但浏览器仍可能要求用户首次交互后才允许播放声音(自动播放策略)。
  • UE 侧若设置 -NOSOUND-PixelStreamingWebRTCDisableTransmitAudio=true,前端开音频也不会有声音。

7. AFK(空闲断开)

用户输入会重置计时器;达到 afkTimeoutSeconds 后:

  1. 向 UE 发送 freeze frame
  2. 主动关闭 WebRTC 与 WebSocket

8. UE 侧码率参数建议

前端 x-google-* 参数不一定能强限制 UE 编码输出;强制限码率请在 UE 启动参数里配置。

推荐(2K60、100Mbps、可能走转发):

-PixelStreamingWebRTCMaxBitrate=25000000
-PixelStreamingEncoderMaxBitrate=30000000

更保守(带宽更紧张):

-PixelStreamingWebRTCMaxBitrate=20000000
-PixelStreamingEncoderMaxBitrate=25000000