ueplayer
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

如何使用

这是自定义的虚幻引擎像素流推送播放器,需要配合自建的Match Maker,不要浪费时间下载。

1 安装

使用pnpm从git仓库安装,具体的语法见:从git安装npm

pnpm install ueplayer

安装完成后的包名叫:ueplayer

2 更新与发布

完成代码更新后,运行pnpm run build,然后提交git仓库,即完成了版本更新。
git更新后,依赖仓库可以运行

pnpm update ueplayer

来完成ueplayer的更新。

3 使用

import { Player } from 'ueplayer'; // for vite user

import { Player, Resolutions } from 'ueplayer/build/player' // for webpack user
import 'ueplayer/build/style.css' // for webpack user

function onVideoReady(player: UePlayer) {
    console.log('player loaded and ready to use')
    setTimeout(() => {
        player.emitUIInteraction({
            command: 'freezeFrame',
            params: null
        })
    }, 5000)
}
<Player appName="haitai" resolution={'auto'} videoReadyCallback={onVideoReady} />

4 参数

注意:api可能随时更新

参数 类型 默认值 说明
appName string - 应用名称,必填,具体应用名称需要参考数据库
resolution string auto 分辨率,可选值:auto、4k、2k、1080p、720p
videoReadyCallback function null 视频加载完成后的回调函数,传入UePlayer参数

videoReadyCallback的签名如下:

type videoReadyCallback = (player: UePlayer) => void

interface UePlayer {
    emitUIInteraction(descriptor: {
        command: string;
        params: any;
    }): void;
    emitCommand(descriptor: any): void;
    on(command: string, listener: (para: CommonUeSendCommand) => void): void;
}

type CommonUeSendCommand = {
    command: string;
    results: any;
}

Readme

Keywords

none

Package Sidebar

Install

npm i ueplayer

Weekly Downloads

2

Version

1.0.3

License

none

Unpacked Size

188 kB

Total Files

34

Last publish

Collaborators

  • jigi330