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 🙏

© 2024 – Pkg Stats / Ryan Hefner

cve-connector

v0.2.13

Published

UE Web 开发套件

Downloads

34

Readme

Connector 是用于 UE5 像素流播放的插件,包含 <cve-player> 组件,15 个 Controller ,点/线/面/体 4 种 Features ,及若干云渲染相关方法。

使用

安装

  • npm
npm install cve-connector@latest
  • yarn
yarn add cve-connector@latest

集成到 Web 页面

  • 在 HTML 模板内使用之前,必须先引入!
  • <cve-player> 的高度不能为 0!
  • 基于模板渲染设置事件回调函数时(以 Vue2 为例):
<cve-player
  application-name="HdecUnrealHaining"
  match-maker-url="http://localhost:1234"
  @error="onError"
  @start="onStart"
>
</cve-player>

<script type="module">
import { defineContainer } from 'cve-connector'

defineContainer()

export default {
  methods: {
    onStart(evt) {
      console.warn('start ===> ', evt.detail)
    },
    onError(evt) {
      console.error('error ===> ', evt.message)
    },
  }
}
</script>
  • 不基于前端框架的集成示例
<!-- HTML Template -->
<cve-player
  application-name="HdecUnrealHaining"
  match-maker-url="http://localhost:1234"
>
</cve-player>

<script type="module">
import { defineContainer } from 'cve-connector'

defineContainer((player) => {
  player.addEventListener('start', (evt) => {
    console.warn('start ===> ', evt.detail)
  })
  player.addEventListener('error', (evt) => {
    console.error('error ===> ', evt.message)
  })
})
</script>

属性

<cve-player
  application-name="HdecUnrealPinglu"
  aspect-ratio="auto"
  match-maker-url="http://39.170.3.124:80/"
  volume="0.3"
>
</cve-player>

application-name

  • 必要属性
  • UE 应用名称,联系 UE 研发人员确认
  • 无默认值

aspect-ratio

  • 可选属性
  • 云渲染视口纵横比例
  • 设置 aspect-ratioauto 时,heightwidth 比例应一致或不设置
  • 示例: 'auto', '16 / 9', '4 / 3'
  • 默认值: 'auto'
  • 补充三种使用情况说明
  • 1、不设置height、width、aspect-ratio
  • 2、设置height、width,但不设置 aspect-ratio
  • 3、不设置height、width,设置 aspect-ratio

match-maker-url

  • 可选属性
  • 云渲染源地址,协议://主机:端口/路径
  • 无默认值

signaling-url

  • 可选属性
  • 信令服务地址,协议://主机:端口/路径
  • 无默认值

volume

  • 可选属性
  • UE 音量
  • 默认值: 0.3

事件

CvePlayer 扩展了 HTMLELment,有更多的事件回调。

| Event | Description | | ------- | ------------------ | | command | Web 发送指令到 UE | | error | 云渲染异常 | | message | UE 传递消息到 Web | | start | 云渲染开始 | | stop | 云渲染结束 |

  • 全局环境下,有且仅有一个 player 元素,请导入后使用;
  • player 可能为空(尚未初始化),请注意校验;
export class CvePlayer extends HTMLELment {
  oncommand?: (evt: CustomEvent<UIDescriptor>) => void
  onerror?: (evt: ErrorEvent) => void
  onmessage?: (evt: CustomEvent<UIDescriptor>) => void
  onstart?: (evt: CustomEvent<number>) => void
  onstop?: (evt: CustomEvent<string>) => void
}
export let player: CvePlayer | undefined

云渲染控制

connect2MatchMaker

import { connect2MatchMaker } from 'cve-connector'
// 运行云渲染程序,使用绑定的源地址和应用名称
connect2MatchMaker()

connect2Signaling

import { connect2Signaling } from 'cve-connector'
// 输入像素流实例地址,重新渲染
connect2Signaling('http://localhost:8081')

defineContainer

import { defineContainer } from 'cve-connector'
// 云渲染插件初始化后,立即执行回调函数
defineContainer(async () => {
  if (!player) {
    return
  }

  player.onstart = () => {
    const reference: CVE.GeoReference = {
      IsOriginLocationInProjectedCRS: true,
      OriginCenter: [116, 39, 100],
    }
    GisController.config(reference)
  }
})

disconnect

import { disconnect } from 'cve-connector'
// 停止渲染
disconnect()

requestInstance

import { requestInstance } from 'cve-connector'
// 获取云渲染实例
requestInstance('http://127.0.0.1:8080', 'HdecUnrealDemo')

useWebSocket

import { useWebSocket } from 'cve-connector'
// 使用 WebSocket 通讯
useWebSocket('ws://127.0.0.1:1000')

useWebUI

import { useWebUI } from 'cve-connector'
// 使用 WebUI 通讯
useWebUI()

补充说明

关于 Controller 和 Feature 的内容,请查看 cve-connector 插件 /docs 目录下相关文档。