+
26
-

回答

可以使用油猴脚本实现

WebRTC P2P 远程网页控制实现方案

完整油猴脚本

// ==UserScript==
// @name         WebRTC P2P 网页远程控制
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  双向P2P连接,远程查看和控制网页
// @match        *://*/*
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-end
// ==/UserScript==

(function() {
    'use strict';

    class WebRTCRemoteControl {
        constructor() {
            this.pc = null;
            this.dataChannel = null;
            this.mode = null; // 'controller' 或 'controlled'
            this.setupUI();
        }

        // 创建控制面板UI
        setupUI() {
            const panel = document.createElement('div');
            panel.innerHTML = `
                <div id="rtc-panel" style="position:fixed;top:10px;right:10px;z-index:999999;
                    background:#2c3e50;color:#ecf0f1;padding:15px;border-radius:8px;
                    font-family:Arial;min-width:300px;box-shadow:0 4px 6px rgba(0,0,0,0.3);">
                    <h3 style="margin:0 0 10px 0;">					

网友回复

我知道答案,我要回答