feat: 增加分辨率修改
This commit is contained in:
@@ -35,6 +35,8 @@ export const store = reactive({
|
||||
controlledDevices: [],
|
||||
stats: null,
|
||||
remoteStream: null,
|
||||
// 被控端上报的当前实际采集分辨率(宽/高/帧率),用于与分辨率下拉框保持一致。
|
||||
currentResolution: null,
|
||||
});
|
||||
|
||||
let signaling = null;
|
||||
@@ -142,6 +144,8 @@ export async function connectToDevice(targetId) {
|
||||
onStream: (stream) => { store.remoteStream = markRaw(stream); },
|
||||
onStats: (stats) => { store.stats = stats; },
|
||||
onError: (msg) => { if (msg) store.error = msg; },
|
||||
// 被控端上报当前实际采集分辨率,同步到 store 供 UI 展示/匹配预设。
|
||||
onResolutionReport: (res) => { store.currentResolution = res; },
|
||||
});
|
||||
await webrtc.createOffer();
|
||||
} catch (e) {
|
||||
@@ -160,6 +164,7 @@ export async function disconnectDevice() {
|
||||
store.dataChannelOpen = false;
|
||||
store.remoteStream = null;
|
||||
store.stats = null;
|
||||
store.currentResolution = null;
|
||||
store.statusText = store.signalingConnected ? '已断开设备连接' : '未连接';
|
||||
}
|
||||
|
||||
@@ -177,3 +182,5 @@ export function sendSwipe(x1, y1, x2, y2, duration) { return webrtc && webrtc.se
|
||||
export function sendLongPress(x, y) { return webrtc && webrtc.sendLongPress(x, y); }
|
||||
export function sendMotionEvent(action, x, y) { return webrtc && webrtc.sendMotionEvent(action, x, y); }
|
||||
export function sendKey(keyCode) { return webrtc && webrtc.sendKey(keyCode); }
|
||||
// 请求被控端切换屏幕采集分辨率(width<=0 表示原生分辨率;height<=0 时按 width 长边依宽高比缩放)
|
||||
export function sendResolutionChange(width, height, fps) { return webrtc && webrtc.sendResolutionChange(width, height, fps); }
|
||||
|
||||
Reference in New Issue
Block a user