参数说明:
| Name | Type | Attributes | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
app |
object | CloudRenderApp 实例(用于访问 DataChannel 和发送能力) |
|||||||||||
opts |
object |
<optional> |
Properties
|
_cache
hash → { refCount, sizeBytes, lastUseTs, mime, width, height, uploaded, bytes?, base64? }
uploaded: true=已发送过 | 'pending'=发送中 | false=未发送/需重传
bytes: 保留原始字节(供三期 §6.E legacy fallback 取 base64 内联)
base64: 惰性生成并缓存的 base64 字符串
hash → { refCount, sizeBytes, lastUseTs, mime, width, height, uploaded, bytes?, base64? }
uploaded: true=已发送过 | 'pending'=发送中 | false=未发送/需重传
bytes: 保留原始字节(供三期 §6.E legacy fallback 取 base64 内联)
base64: 惰性生成并缓存的 base64 字符串
getBase64Sync(hash) → {string|null}
三期 §6.E:同步返回某个 ref 对应的 data URL("data:
命中则惰性 encode 并缓存,未命中返回 null(调用方保持 ref 原值)
参数说明:
| Name | Type | Description |
|---|---|---|
hash |
string |
Returns:
- Type
- string | null
markMissing(hash)
UE 端 NACK 后调用:标记该哈希需要重传
参数说明:
| Name | Type | Description |
|---|---|---|
hash |
string |
(async) publishTexture(input) → {Promise.<{ref: string}>}
上传贴图并返回 ref(哈希字符串)。
若该贴图已上传过,直接返回 ref,不重复发送。
参数说明:
| Name | Type | Description |
|---|---|---|
input |
HTMLCanvasElement | string | Uint8Array |
Returns:
- Type
- Promise.<{ref: string}>
releaseTexture(ref)
减少引用计数(可选调用)
参数说明:
| Name | Type | Description |
|---|---|---|
ref |
string |
resetUploadState()
断线重连时重置所有贴图的上传状态,使重连后重新发送 BinaryAsset 帧
resolveRef(ref) → {Object|null}
同步解析:若已上传返回 { ref },否则返回 null(调用方降级到 base64)
参数说明:
| Name | Type | Description |
|---|---|---|
ref |
string | null | 哈希字符串 |
Returns:
- Type
- Object | null