{"id":1066,"date":"2014-09-02T11:02:29","date_gmt":"2014-09-02T03:02:29","guid":{"rendered":"https:\/\/cowman-chiang.no-ip.org\/wordpress\/?p=1066"},"modified":"2023-10-31T15:46:01","modified_gmt":"2023-10-31T07:46:01","slug":"obs-remote-webclient-%e4%bf%ae%e6%ad%a3%e7%82%ba%e5%8f%af%e5%b8%b6%e9%80%9a%e8%a8%8a%e5%9f%a0%e8%b3%87%e8%a8%8a","status":"publish","type":"post","link":"https:\/\/cowmanchiang.me\/wp\/?p=1066","title":{"rendered":"OBS Remote Webclient \u4fee\u6b63\u70ba\u53ef\u5e36\u901a\u8a0a\u57e0\u8cc7\u8a0a"},"content":{"rendered":"<p>\u5728\u7814\u7a76 <a href=\"https:\/\/obsproject.com\/\">OBS (Open Broadcaster Software)<\/a> \u6642\u610f\u5916\u767c\u73fe\u4e86\u4e00\u500b\u597d\u7528\u7684 Plugin <a href=\"http:\/\/www.obsremote.com\/\">OBS Remote<\/a><br \/>\n\u5176\u7528\u610f\u4e3b\u8981\u5c31\u662f\u7576OBS\u5b89\u88dd\u4e86Plugin\u5f8c~\u53ef\u4ee5\u900f\u904e\u624b\u6a5fAPP\u3001Web\u7b49\u74b0\u5883\u7d93\u7531WebSocket\u7684\u65b9\u5f0f\u9032\u884c\u63a7\u5236<br \/>\n\u9810\u8a2d\u8d70\u7684Port\u662fTCP 4444\uff0c\u5982\u679c\u9700\u8981\u6539Port\u7684\u8a71\u5c31\u5fc5\u9808\u8981\u6539\u4e00\u4e0b\u8a9e\u6cd5\u4e86<\/p>\n<pre lang=\"javascript\">\n\/\/\u539f\u672c\u7684 js \/ websocket.js \u6a94\u6848\nfunction connectWebSocket(host)\n{\n  connectingHost = host;\n\n  var url = \"ws:\/\/\" + connectingHost + \":4444\";\n\n  console.log(\"trying to connect to: \" + url);\n  if (typeof MozWebSocket != \"undefined\") \n  {\n    socket_obsapi = new MozWebSocket(url, \"obsapi\");\n  } \n  else \n  {\n    socket_obsapi = new WebSocket(url, \"obsapi\");\n  }\n\n  try {\n    socket_obsapi.onopen = _onWebSocketConnected;\n    socket_obsapi.onmessage = _onWebSocketReceiveMessage;\n    socket_obsapi.onerror = _onWebSocketError;\n    socket_obsapi.onclose = _onWebSocketClose;\n  } catch(exception) {\n    alert('<p>Error' + exception);  \n  }\n}\n<\/pre>\n<pre lang=\"javascript\">\n\/\/\u4fee\u6539\u5f8c\u7684 js \/ websocket.js \u6a94\u6848\nfunction connectWebSocket(host)\n{\n  var n = host.indexOf(\":\");\n  \/\/console.log(n.toString());\n  if (n == -1)\n  {\n    console.log(\"\u6c92\u6709\u5e36port\u8cc7\u8a0a\");\n    connectingHost = host;\n    var url = \"ws:\/\/\" + connectingHost + \":4444\";\n  }\n  else\n  {\n    console.log(\"\u6709\u5e36port\u8cc7\u8a0a\");\n    var hosts = host.split(\":\");\n    connectingHost = hosts[0];\n    var url = \"ws:\/\/\" + connectingHost + \":\" + hosts[1];\n  }\n\n  console.log(\"trying to connect to: \" + url);\n  if (typeof MozWebSocket != \"undefined\")\n  {\n    socket_obsapi = new MozWebSocket(url, \"obsapi\");\n  }\n  else\n  {\n    socket_obsapi = new WebSocket(url, \"obsapi\");\n  }\n\n  try {\n    socket_obsapi.onopen = _onWebSocketConnected;\n    socket_obsapi.onmessage = _onWebSocketReceiveMessage;\n    socket_obsapi.onerror = _onWebSocketError;\n    socket_obsapi.onclose = _onWebSocketClose;\n  } catch(exception) {\n    alert('<p>Error' + exception);\n  }\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u7814\u7a76 OBS (Open Broadcaster Software) \u6642\u610f\u5916\u767c\u73fe\u4e86\u4e00\u500b\u597d\u7528\u7684 Plugin OBS Remote \u5176\u7528\u610f\u4e3b\u8981\u5c31\u662f\u7576OBS\u5b89\u88dd\u4e86Plugin\u5f8c~\u53ef\u4ee5\u900f\u904e\u624b\u6a5fAPP\u3001Web\u7b49\u74b0\u5883\u7d93\u7531WebSocket\u7684\u65b9\u5f0f\u9032\u884c\u63a7\u5236 \u9810\u8a2d\u8d70\u7684Port\u662fTCP 4444\uff0c\u5982\u679c\u9700\u8981\u6539Port\u7684\u8a71\u5c31\u5fc5\u9808\u8981\u6539\u4e00\u4e0b\u8a9e\u6cd5\u4e86 \/\/\u539f\u672c\u7684 js \/ websocket.js \u6a94\u6848 function connectWebSocket(host) { connectingHost = host; var url = &#8220;ws:\/\/&#8221; + connectingHost + &#8220;:4444&#8221;; console.log(&#8220;trying to connect to: &#8221; + url); if (typeof &hellip; <a href=\"https:\/\/cowmanchiang.me\/wp\/?p=1066\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-1066","post","type-post","status-publish","format-standard","hentry","category-obs"],"_links":{"self":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1066","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1066"}],"version-history":[{"count":1,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1066\/revisions"}],"predecessor-version":[{"id":2012,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1066\/revisions\/2012"}],"wp:attachment":[{"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1066"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cowmanchiang.me\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}