- 先在OBS安裝 websocket
https://github.com/obsproject/obs-websocket/releases/tag/4.9.1 安裝obs-websocket-4.9.1-Windows-Installer.exe 2.OSB會出現 工具 會出現 websocket server setting
3.設定 websocket port 與 密碼 4.然後python #!/usr/bin/env python
-- coding: utf-8 --
import sys import time
import logging logging.basicConfig(level=logging.INFO)
sys.path.append(’…/’) from obswebsocket import obsws, requests # noqa: E402 host = “localhost” port = 4444 password = “12345678” ws = obsws(host, port, password) ws.connect() try:
ddd=ws.call(requests.GetSourceSettings(sourceName="test123") )
print("ddd1:",ddd.getSourceSettings()["window"])
mmm=ws.call(requests.SetSourceSettings(sourceName="test123", sourceSettings={'window':'我:Qt5152QWindowIcon:LINE.exe'} )) #OK
ddd=ws.call(requests.GetSourceSettings(sourceName="test123"))
print("ddd2:",ddd.getSourceSettings()["window"])
except KeyboardInterrupt: pass
ws.disconnect()
5.結果 可以置換 source 項目 (facebook) C:\Users\111\qt_exam\obs>python try0203.py INFO:obswebsocket.core:Connecting… INFO:obswebsocket.core:Connected! ddd1: Get Window Dropdown List for Window Capture Source? · Issue #22754 · obsproject/obs-websocket · GitHub 和其他 7 個頁面 - 設定檔 1 - Microsoft? Edge:Chrome_WidgetWin_1:msedge.exe ddd2: 我:Qt5152QWindowIcon:LINE.exe INFO:obswebsocket.core:Disconnecting…
|