Files
meetingroom-netscreen/auto_receive.py

38 lines
1.2 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)