feat: 增加分辨率修改

This commit is contained in:
2026-07-21 11:05:40 +08:00
parent 9e5ac91e46
commit 341dce249f
25 changed files with 646 additions and 6 deletions

View File

@@ -13,6 +13,8 @@ export const Action = {
KEY: 3,
LONG_PRESS: 4,
MOTION_EVENT: 5,
SET_RESOLUTION: 6,
REPORT_RESOLUTION: 7,
};
export async function loadProto() {
@@ -29,3 +31,9 @@ export function encodeControlMessage(fields) {
// 返回 Uint8Array可直接通过 RTCDataChannel.send 发送(二进制)。
return ControlMessage.encode(message).finish();
}
/** 解析被控端经 DataChannel 发来的二进制 protobuf如分辨率上报。返回消息对象。 */
export function decodeControlMessage(bytes) {
if (!ControlMessage) throw new Error('protobuf 尚未加载,请先调用 loadProto()');
return ControlMessage.decode(bytes);
}