您已經在使用猿大師中間件(官網:http://www.yuanmaster.com)解決海康威視、大華RTSP視頻流播放的項目,如果不滿足單一播放,實現多路同時播放可以在HTML代碼中做如下設置:
<iframe name="VLCApplet" id="VLCApplet" src="VLCApplet3.html" frameborder="0" align="left" width="550" height="540" scrolling="no>
<param ID="2" Play="http://www.yuanmaster.com/DAHUARTSP.mp4" />
<param ID="3" Play="rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream" Caching="500" />
</iframe>
或者直接用
<div id="VLCApplet" class="VLCApplet"
<param ID="2" Play="http://www.yuanmaster.com/DAHUARTSP.mp4" />
<param ID="3" Play="rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream" Caching="500" />
</div>
其中param指定具體的播放源,ID為窗口序號,第一個窗口的播放源已經在啟動播放的JSON包中配置,這里就無需再配置。Caching是指定緩存時間,控制播放延遲效果的關鍵參數,如在這里設置了,那么Config.json中的配置就無效。如果在HTML網頁中不方便配置多源,可在啟動播放窗口后,新建一個WS連接到啟動后的播放小程序偵聽端口,再調用以下指令指定播放源:
動態改變分屏數量或播放內容
ShowType指定分屏數量,如果不變就不設置
Play重新指定播放內容
請求范例1:
{"req":"VLC_ChangePlay","rid":79,"para":{"ShowType":2}}
請求范例2:
{"req":"VLC_ChangePlay","rid":79,"para":{"Play":[{"ID":1,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Name":"BrowserApplet1","Option":":rtsp-tcp"},{"ID":2,"Uri":"http://www.zorrosoft.com/Files/PluginOKBrowserApplet.mp4","Name":"BrowserApplet2","Option":":file-caching=300"}]}}
請求范例3:
{"req":"VLC_ChangePlay","rid":79,"para":{"ShowType":3,"Play":[{"ID":1,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Name":"BrowserApplet1","Option":":rtsp-tcp :network-caching=300"},{"ID":2,"Uri":"http://www.zorrosoft.com/Files/PluginOKBrowserApplet.mp4","Name":"BrowserApplet2","Option":":file-caching=400"},{"ID":3,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Name":"BrowserApplet3","Option":":rtsp-tcp"}]}}
分別返回:
{"ret":0,"rid":80,"data":{"Ret":0,"Play":[]}}