初始化项目:添加README和核心Python脚本
This commit is contained in:
38
auto_receive.py
Normal file
38
auto_receive.py
Normal file
@@ -0,0 +1,38 @@
|
||||
import subprocess
|
||||
import time
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 配置项(可通过命令行传参切换模式)
|
||||
SERVER_IP = "192.168.1.100"
|
||||
BROWSER_PATH = r"C:\Program Files\Google\Chrome\Application\chrome.exe"
|
||||
|
||||
# 自动打开浏览器(模式1/2:投屏流;模式3:会议流)
|
||||
def open_receive_browser(mode="screen"):
|
||||
# 关闭已有Chrome窗口(避免多开)
|
||||
try:
|
||||
subprocess.run(["taskkill", "/f", "/im", "chrome.exe"], capture_output=True)
|
||||
except:
|
||||
pass
|
||||
time.sleep(1)
|
||||
|
||||
# 拼接流地址(全屏+无地址栏)
|
||||
if mode == "screen":
|
||||
url = f"http://{SERVER_IP}:8889/webrtc.html?src=screen"
|
||||
elif mode == "meeting":
|
||||
url = f"http://{SERVER_IP}:8889/webrtc.html?src=meeting"
|
||||
|
||||
# 打开Chrome(全屏 kiosk模式,无操作栏)
|
||||
subprocess.Popen([
|
||||
BROWSER_PATH,
|
||||
"--kiosk", # 全屏模式
|
||||
"--start-maximized",
|
||||
"--disable-infobars",
|
||||
url
|
||||
])
|
||||
print(f"已打开{mode}流接收页面:{url}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 支持命令行传参切换模式(比如:python auto_receive.py meeting)
|
||||
mode = sys.argv[1] if len(sys.argv) > 1 else "screen"
|
||||
open_receive_browser(mode)
|
||||
Reference in New Issue
Block a user