feat: 增加分辨率修改
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user