Categories
- FFMpeg (5)
- Libav (1)
- Google (3)
- iBeacon (1)
- LDAP (3)
- Me (2)
- Network (11)
- OS (149)
- RTMP (4)
- SIP (1)
- Kamailio (1)
- SNMP (1)
- VMware (20)
- VCP考試 (1)
- 伺服器 網站服務 (105)
- 名詞解釋 (4)
- 專案管理 (1)
- 工具軟體 (50)
- Adobe (1)
- FMS (1)
- Cloudera (1)
- Docker (1)
- Eclipse (4)
- Intellij (2)
- OBS (2)
- Office (10)
- Excel (4)
- PowerPoint (5)
- Postman (1)
- Splunk (13)
- Virtualbox (2)
- Visual Studio (2)
- 文字編輯器 (10)
- Sublime Text 2 (6)
- Sublime Text 3 (3)
- Vim (3)
- 連線工具 (1)
- Xshell (1)
- Adobe (1)
- 程式語言 (79)
- CSS (2)
- HTML (2)
- iOS (1)
- Java (30)
- JavaScript (5)
- jQuery (4)
- jsTree (2)
- JSP (3)
- PHP (16)
- Python (7)
- Ruby (1)
- sed (1)
- Shell Script (8)
- Windows Bash Script (1)
- XML (1)
- 資料庫 (37)
- FFMpeg (5)
Category Archives: OBS
OBS – Get Active Publish Streaming
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <!--使用html格式輸出--> <xsl:template match="stream"> <!--抓取stream template的內容--> <table> <tr id="cowtr"> <td id="cowtd"> <!--這邊只是為了給後續php parse表格內容時的tag--> <xsl:choose> <xsl:when test="active"> <!--當狀態是active的時候,即為publish狀態--> <xsl:value-of select="name"/> <!--只抓取名稱--> </xsl:when> </xsl:choose> </td> </tr> </table> </xsl:template> </xsl:stylesheet> |
然後再使用php進行parse去除不必要的資訊
1 2 3 4 5 6 7 8 9 10 |
<?php include_once('simple_html_dom.php'); #這邊的simple_html_dom.php是到http://sourceforge.net/projects/simplehtmldom/files/ 進行下載 $cowdata=file_get_html("http://10.9.50.53/streamlist"); #將html抓回成html dom物件 foreach($cowdata->find('td') as $element){ #尋找介於td內的資料 echo "<client>".$element->plaintext . "</client>n"; } ?> |
Posted in OBS, PHP, XML
Leave a comment
OBS Remote Webclient 修正為可帶通訊埠資訊
在研究 OBS (Open Broadcaster Software) 時意外發現了一個好用的 Plugin OBS Remote 其用意主要就是當OBS安裝了Plugin後~可以透過手機APP、Web等環境經由WebSocket的方式進行控制 預設走的Port是TCP 4444,如果需要改Port的話就必須要改一下語法了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//原本的 js / websocket.js 檔案 function connectWebSocket(host) { connectingHost = host; var url = "ws://" + connectingHost + ":4444"; console.log("trying to connect to: " + url); if (typeof MozWebSocket != "undefined") { socket_obsapi = new MozWebSocket(url, "obsapi"); } else { socket_obsapi = new WebSocket(url, "obsapi"); } try { socket_obsapi.onopen = _onWebSocketConnected; socket_obsapi.onmessage = _onWebSocketReceiveMessage; socket_obsapi.onerror = _onWebSocketError; socket_obsapi.onclose = _onWebSocketClose; } catch(exception) { alert('<p>Error' + exception); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
//修改後的 js / websocket.js 檔案 function connectWebSocket(host) { var n = host.indexOf(":"); //console.log(n.toString()); if (n == -1) { console.log("沒有帶port資訊"); connectingHost = host; var url = "ws://" + connectingHost + ":4444"; } else { console.log("有帶port資訊"); var hosts = host.split(":"); connectingHost = hosts[0]; var url = "ws://" + connectingHost + ":" + hosts[1]; } console.log("trying to connect to: " + url); if (typeof MozWebSocket != "undefined") { socket_obsapi = new MozWebSocket(url, "obsapi"); } else { socket_obsapi = new WebSocket(url, "obsapi"); } try { socket_obsapi.onopen = _onWebSocketConnected; socket_obsapi.onmessage = _onWebSocketReceiveMessage; socket_obsapi.onerror = _onWebSocketError; socket_obsapi.onclose = _onWebSocketClose; } catch(exception) { alert('<p>Error' + exception); } } |
Posted in OBS
Leave a comment