开发文档

主页 > 开发文档 > 猿大师中间件VLC播放器内嵌网页小程序开发文档

猿大师中间件VLC播放器内嵌网页小程序开发文档

栏目:开发文档   日期:2021-09-10 14:18:14   浏览

猿大师中间件VLC多媒体播放器内嵌网页小程序开发原理:

 

基于猿大师中间件网络版开发,底层调用VLC的ActiveX控件axvlc.dll(需安装VLC media player或搭配绿色版VLC播放程序)可实现在网页中内嵌播放多路RTSP的实时视频流。最低可用在Chrome 41、Firefox 50、Edge 80(Chromium内核)、360极速/安全、IE、Oprea 36、QQ等浏览器,也兼容运行于这些浏览器的最新版本。

 

1.猿大师中间件VLC多媒体播放器内嵌网页小程序的安装步骤:

 

1)、如果是exe的安装程序,请直接运行安装;
2)、如果是绿色版的程序包,请解压到磁盘某个目录后,双击“InstallWrl.bat”进行安装;
3)、安装完成时会启动猿大师中间件服务,在安装目录下的Data子目录有WrlService.txt日志文件输出运行情况。

 

2.猿大师中间件VLC多媒体播放器内嵌网页小程序控制相关接口:

 

说明:以下功能请通过Web Socket连接猿大师主服务(ws://localhost:83?sid=12345&flag=1)后可执行,如默认侦听端口不是83(关于如何配置侦听端口,请参考SDK包中的文档“猿大师开发者手册.doc”),请在连接地址中指定端口号进行连接。

 

HTTP网页在线测试:http://test.yuanmaster.com/vlcwebfull.html  
HTTPS网页在线测试:https://test.yuanmaster.com/vlcwebPlayer.html

 

前端集成可参考以上测试网页进行,HTML网页中需要嵌入以下类似代码;
A、标记小程序的显示位置和大小
.VLCWebPlayer {
            margin: 20px 0 0 20px;
            width: 480px;
            height: 320px;
            border: 1px solid blue;
        }
或者
.VLCWebPlayer{
            width: 480px;
            height: 320px;
            top: 20px;
            left: 20px;
            border: 1px solid blue;
        }
如果在网页Header区没有标记小程序初始显示位置和大小,请在启动小程序的JSON参数里,添加以下参数:
"Left":20,"Top":20,"Width":480,"Height":320

 

B、网页中嵌入元素
支持IFrame的:
<iframe name="VLCWebPlayer" id="VLCWebPlayer" src="VLCWebPlayer3.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="VLCWebPlayer" class="VLCWebPlayer"</div>

 

另外需要嵌入用到的JS脚本,脚本程序是完全开源的。

 

播放窗口选中状态时单击即可全屏显示,全屏显示状态通过ESC按键取消,全屏切换会发送JSON包的VLC_FullScreen通知。

 

1)、请求启动VLC多媒体播放网页小程序:
Type为浏览器类型,传0自动判断(前提是当前浏览器已启动并显示在最前端,Flag指定当前页加载时必须是0) 可强制指定浏览器类型Type(1代表IE 2代表Chrome 4代表Firefox 8代表Opera 16代表Edge(Chromium内核) 32代表360极速浏览器 33代表360安全浏览器 34代表360企业安全浏览器 50代表QQ浏览器 60代表搜狗浏览器)
Title:网页标题中的关键词
Flag掩码标记:1指定新标签加载(1和16都不指定时为当前页加载) 2小程序显示窗口边框 4不自动裁剪越界窗口 8自动适配网页高度和宽度显示  64根据标题避免重复加载相同的小程序
IframeX和IframeY分别为iframe嵌套的横竖偏移修正坐标
BarW和BarH分别是网页右侧和底部预留区域
小程序实际显示首先会基于网页中指定的坐标和大小,再根据IframeX、IframeY、BarW、BarH设定的值做修正
ShowType 播放窗口分屏类型,默认1只显示一个播放窗口,支持1-21 24 25等多达20种多窗口播放。
Url:加载小程序所在的网页实际地址
Open :启动后自动播放的流地址或本地多媒体文件路径,斜杠替换成/再传
注意:Open和Url如果有特殊字符或中文等,需要用URL编码处理后传递
举例:
自动识别当前浏览器指定位置和大小启动:
{"req":"Wrl_VLCWebPlayer","rid":4,"para":{"Type":"0","Title":"VLC Web Player","Flag":2,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"Url": "http://test.yuanmaster.com/VLCWebPlayer.html","ShowType":1,"Open":"https://vjs.zencdn.net/v/oceans.mp4"}}

 

自动识别当前浏览器自动适配网页大小启动:
{"req":"Wrl_VLCWebPlayer","rid":4,"para":{"Type":"0","Title":"VLC Web Player","Flag":10,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"Url": "http://test.yuanmaster.com/VLCWebPlayer.html","ShowType":1,"Open":"http://www.yuanmaster.com/DAHUARTSP.mp4"}}

 

当前页指定位置自动适配网页加载测试
http://test.yuanmaster.com/VLCWebPlayer.html

 

启动后会前后收到三个JSON数据包
A、{"ret":0,"rid":1,"data":{"ID":2}}
代表小程序WS侦听服务就绪
B、{"event":"Wrl_Listen","aid":2,"data":{"SID":"123","PID":"VLCWebPlayer","port":935}}
返回的侦听端口,可再建立一个Web Socket连接后,调用小程序中的相关功能,比如重新指定播放一个视频。
代表小程序创建成功,返回ID为当前小程序运行ID,通过此ID,可执行Wrl_AppletControl、Wrl_AppletScroll、Wrl_AppletResize等命令。
C、{"event":"Wrl_AppletOK","aid":2,"data":{"SID":"123","PID":"VLCWebPlayer","Port":935}}

 

2)、请求控制VLC多媒体播放网页小程序:
当前端不再需要小程序时可指定关闭,或者显示/隐藏及全屏显示等
ID为Wrl_VLCWebPlayer启动小程序时返回的ID值,Code代表控制类型掩码:1关闭 2全屏显示 4自动隐藏 8还原显示 16自动适配网页高度和宽度显示模式切换 32强制隐藏。其中全屏显示2,可直接通过热键ESC或取消,设置4和32隐藏后可通过8恢复显示
{"req":"Wrl_AppletControl","rid":2,"para":{"ID":"1","Code":4}}

 

3)、请求滚动VLC多媒体播放网页小程序:
当前端截取到网页滚动通知时,需要调用此接口实现小程序和网页的滚动联动
ID为启动小程序时返回JSON中的ID值
Code为滚动方向1是水平直,2是垂直,3是同时
Left为横向滚动条位置,Top为纵向滚动条位置
{"req":"Wrl_AppletScroll","rid":3,"para":{"ID":"1","Code":2,"Left":0,"Top":100}}

 

4)、请求改变VLC多媒体播放网页小程序显示位置或大小:
当前端网页显示区域缩放时,可动态修改小程序的显示位置或大小
ID为Wrl_VLCWebPlayer启动小程序时返回的ID值,Width和Height分别为新的宽度和高度
X和Y分别为新的显示位置,不指定时保持不变,指定时原设置的IframeX和IframeY失效
{"req":"Wrl_AppletResize","rid":4,"para":{"ID":1,"Width":500,"Height":600}}
或,同时修改小程序显示起始坐标
{"req":"Wrl_AppletResize","rid":5,"para":{"ID":1,"Width":500,"Height":600,"X":20,"Y":20}}

 

5)、请求设置网页预留右侧宽度和底部高度,滚动条信息、垂直滚动及水平滚动位置:
当小程序显示区域超过当前网页时,需去除滚动条的显示影响
ID为启动小程序时返回的ID值,BarW为预留右侧宽度 BarH为预留底部高度
Code 1代表有水平滚动条,2代表有垂直滚动条,3代表都有
ScrollTop垂直滚动条位置 ScrollTop水平滚动条位置
{"req":"Wrl_ScrollBar","rid":6,"para":{"ID":"1","Code":2,"BarW":0,"BarH":0,"ScrollTop":0,"ScrollLeft":0}}

 

6)、请求对小程序窗口做Alpha透明处理,便于前端临时显示覆盖到小程序窗口的菜单等:
ID为Wrl_VLCWebPlayer启动小程序时返回的ID值,Alpha为透明度百分比,1-100
{"req":"Wrl_AppletAlpha","rid":7,"para":{"ID":1,"Alpha":30}}

 

7)、请求对小程序窗口内容进行截图:
ID为启动小程序时返回JSON中的ID值,
File为指定截图文件保存路径或扩展名
Base64指定为1时代表返回BASE64编码的图像内容
{"req":"Wrl_AppletSnap","rid":10,"para":{"ID":1,"Base64":1,"File":".png"}}

 

8)、请求缩放IE控件内嵌网页小程序,用于浏览器网页按比例缩放,一般不需要处理:
ID为启动小程序时返回JSON中的ID值,Scall为缩放百分比
{"req":"Wrl_AppletScale","rid":11,"para":{"ID":1,"Scale":120}}

 

3、小程序安装、升级、卸载
1)、请求安装VLC多媒体播放网页小程序
请在输入框中,输入如下请求,然后点击发送,完成安装:

 

{"req":"Plugin_Install","rid":1,"para":{"Name":"VLC内嵌网页多媒体播放小程序","PID":"VLCWebPlayer","Date":"2021-03-27","Desc":"猿大师之上跨浏览器的VLC多媒体播放内嵌网页小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中直接内嵌使用,可播放多路海康及大华等设备的实时视频","DownAddr":"http://local.zorrosoft.com/Files/Net/VlcPlayer.pid","MD5":"8329E3E5681AE325FC6AB463FA624844","Version":"2.1.3.1","Size":786432,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"3F49D8C789497ECE1ADB296140AB8895EA84C76857EA2B8EF2BB005772C4BEA3C61A0B23AC6C061D4DF213316A6D2DDFBA510C9997AFFB5B9C29F53D37C046A410DDB2828C1728143003B360FE1DD5367233039E56F4D46B5FCFA213906DE3D3F6BF204E95CBC65E068B51BB89AD6A1A70030FB66B2DDD517C6E553CDB5F4B0B9CC8B6272260FE124B7541425802B25890BA6210E9AD05ED7BD459B98571E6A042CFB69A33054B53A0AA103AA344781837E58F932B581A7F4AF42E465B9141760EA6682C0C56F035C087201E68403A09B37FF99E7F35C0D2BDF46D2F73667E9E0F765AB2891C798A5E11F9D27CA707B30BDDA833CF36744E06EAEE17093D7D72"}}

 

启动安装后,会不断收到安装进度直到安装结束。

 

2)、请求升级VLC多媒体播放网页小程序:

 

{"req":"Plugin_Update","rid":1,"para":{"Name":"VLC内嵌网页多媒体播放小程序","PID":"VLCWebPlayer","Date":"2021-03-27","Desc":"猿大师之上跨浏览器的VLC多媒体播放内嵌网页小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中直接内嵌使用,可播放多路海康及大华等设备的实时视频","DownAddr":"http://local.zorrosoft.com/Files/Net/VlcPlayer_Update.pid","MD5":"494DF12C89611F07488B1DE1EB634A5F","Version":"2.1.3.1","Size":786432,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"B41EB83C9FC8E93E58596D4559942762A704B09E14AFE06DF1202A588D0A1A152B40BA9405B670E81F31830971DE508263786E6CD3A6E68B2C1973D170994402C6B54BB3EFFB5440CB02080D6182EE26E85728EE735C5FD25B415336F8802353E9D6BD5CEFED41EBC2F05397557AC2E0762D9BE60424F03C172098C5DD16743E3B9925AE4A6EB14DCDBB66964865A67D1524B1B03578BAB418B9D6B0EC7B7565DB7F4EE060F23594ED0C2617A1E984038FB666792C13F93848439D7BE3C6CA16D5451AED1CC950C237659F4927A4E32B67FF9A08DCAB3EB0F623B7740959052003434A825A967CD6F21D5024ECF5800D1534B6351BBE248F8449D38D76A98F8B"}}

 

以上安装和升级的JSON请求包,可能因版本升级导致内容不同,如遇安装或升级时报错,请联系客服获取最新的请求包。 

 

3)、请求卸载VLC多媒体播放网页小程序:

 

{"req":"Plugin_Remove","rid":3,"para":{"PID":"VLCWebPlayer","Type":8}}

 

4、VLC多媒体播放网页小程序转调用ActiveX接口(接口说明:https://wiki.videolan.org/Documentation:WebPlugin ),先根据Wrl_VLCWebPlayer请求启动后返回的端口号,针对此端口新建一个WebSocket连接后可执行如下指令:

 

A、ActiveX接口功能请求:
支持创建多个VLC的ActiveX控件窗口同时播放多路实时视频,所以请求参数里需要指定窗口序号ID,从1开始,序号原则是从左向右开始编号,然后从上到下开始顺序编号,如遇右侧多层排列窗口时,直到右侧窗口序号排序完成

 

1) 取指定ID播放窗口属性AutoLoop(自动循环)值,举例:
请求:{"req":"VLC_GetAutoLoop","rid":41,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":41,"ID":1,"data":{"Ret":0,"AutoLoop":0}} 和 {"ret":0,"rid":41,"ID":2,"data":{"Ret":0,"AutoLoop":0}}
ret为请求返回值,0正常,非零不正常,不正常时请取和ret同级的错误描述err,下同
Ret为调用ActiveX对应函数返回值,0代表正常

 

2) 设置指定ID控件窗口AutoLoop(自动循环)值,举例:
请求:{"req":"VLC_PutAutoLoop","rid":42,"para":[{"ID":1,"AutoLoop":1},{"ID":2,"AutoLoop":0}]}
分别返回:{"ret":0,"rid":42,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":42,"ID":2,"data":{"Ret":0}}

 

3) 取指定ID控件窗口AutoPlay(自动播放)值,举例:
请求:{"req":"VLC_GetAutoPlay","rid":43,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":43,"ID":1,"data":{"Ret":0,"AutoPlay":0}} 和 {"ret":0,"rid":43,"ID":2,"data":{"Ret":0,"AutoPlay":0}}

 

4) 设置指定ID窗口AutoPlay(自动播放)值,举例:
请求:{"req":"VLC_PutAutoPlay","rid":44,"para":[{"ID":1,"AutoPlay":1},{"ID":2,"AutoPlay":0}]}
分别返回:{"ret":0,"rid":44,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":44,"ID":2,"data":{"Ret":0}}

 

5) 取指定ID窗口StartTime(开始时间)值,举例:
请求:{"req":"VLC_GetStartTime","rid":45,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":45,"ID":1,"data":{"Ret":0,"StartTime":0}} 和 {"ret":0,"rid":45,"ID":2,"data":{"Ret":0,"StartTime":0}}

 

6) 设置指定ID窗口StartTime(开始时间)值,举例:
请求:{"req":"VLC_PutStartTime","rid":46,"para":[{"ID":1,"StartTime":0},{"ID":2,"StartTime":0}]}
分别返回:{"ret":0,"rid":46,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":46,"ID":2,"data":{"Ret":0}}

 

7) 取指定ID窗口MRL(播放源)值,举例:
请求:{"req":"VLC_GetMRL","rid":47,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":47,"ID":1,"data":{"Ret":0,"MRL":""}} 和 {"ret":0,"rid":47,"ID":2,"data":{"Ret":0,"MRL":""}}

 

8) 设置指定ID窗口MRL(播放源)值,举例:
请求:{"req":"VLC_PutMRL","rid":48,"para":[{"ID":1,"MRL":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream"},{"ID":2,"MRL":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream"}]}
分别返回:{"ret":0,"rid":48,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":48,"ID":2,"data":{"Ret":0}}

 

9) 取指定ID窗口Visible(可见性),举例:
请求:{"req":"VLC_GetVisible","rid":49,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":49,"ID":1,"data":{"Ret":0,"Visible":1}} 和 {"ret":0,"rid":49,"ID":2,"data":{"Ret":0,"Visible":0}}

 

10) 设置指定ID窗口Visible(可见性),举例:
请求:{"req":"VLC_PutVisible","rid":48,"para":[{"ID":1,"Visible":1},{"ID":2,"Visible":0}]}
分别返回:{"ret":0,"rid":50,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":50,"ID":2,"data":{"Ret":0}}

 

11) 取指定ID窗口Volume(音量),举例:
请求:{"req":"VLC_GetVolume","rid":51,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":51,"ID":1,"data":{"Ret":0,"Volume":0}} 和 {"ret":0,"rid":51,"ID":2,"data":{"Ret":0,"Volume":0}}

 

12) 设置指定ID窗口Volume(音量),举例:
请求:{"req":"VLC_PutVolume","rid":52,"para":[{"ID":1,"Volume":0},{"ID":2,"Volume":0}]}
分别返回:{"ret":0,"rid":52,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":52,"ID":2,"data":{"Ret":0}}

 

13) 取指定ID窗口BackColor(背景色),举例:
请求:{"req":"VLC_GetBackColor","rid":53,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":53,"ID":1,"data":{"Ret":0,"BackColor":0}} 和 {"ret":0,"rid":53,"ID":2,"data":{"Ret":0,"BackColor":0}}

 

14) 设置指定ID窗口BackColor(背景色),举例:
请求:{"req":"VLC_PutBackColor","rid":54,"para":[{"ID":1,"BackColor":0},{"ID":2,"BackColor":0}]}
分别返回:{"ret":0,"rid":54,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":54,"ID":2,"data":{"Ret":0}}

 

15) 取指定ID窗口Toolbar(工具栏)显示与否,举例:
请求:{"req":"VLC_GetToolbar","rid":55,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":55,"ID":1,"data":{"Ret":0,"Toolbar":0}} 和 {"ret":0,"rid":55,"ID":2,"data":{"Ret":0,"Toolbar":0}}

 

16) 设置指定ID窗口Toolbar(工具栏)显示与否,举例:
请求:{"req":"VLC_PutToolbar","rid":56,"para":[{"ID":1,"Toolbar":0},{"ID":2,"Toolbar":0}]}
分别返回:{"ret":0,"rid":56,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":56,"ID":2,"data":{"Ret":0}}

 

17) 取指定ID窗口FullScreenEnabled(全屏启用),举例:
请求:{"req":"VLC_GetFullScreenEnabled","rid":57,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":57,"ID":1,"data":{"Ret":0,"FullScreenEnabled":0}} 和 {"ret":0,"rid":57,"ID":2,"data":{"Ret":0,"FullScreenEnabled":0}}

 

18) 设置指定ID窗口FullScreenEnabled(全屏启用),举例:
请求:{"req":"VLC_PutFullScreenEnabled","rid":58,"para":[{"ID":1,"FullScreenEnabled":0},{"ID":2,"FullScreenEnabled":0}]}
分别返回:{"ret":0,"rid":58,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":58,"ID":2,"data":{"Ret":0}}

 

19) 取指定ID窗口版本信息,举例:
请求:{"req":"VLC_GetVersionInfo","rid":59,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":59,"ID":1,"data":{"Ret":0,"VersionInfo":""}} 和 {"ret":0,"rid":59,"ID":2,"data":{"Ret":0,"VersionInfo":""}}

 

20) 取指定ID窗口多媒体描述信息,举例:
请求:{"req":"VLC_MediaDescGet","rid":60,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":60,"ID":1,"data":{"Ret":0,"Title":"","Artist":"","Genre":"","Copyright":"","Album":"","TrackNumber":"","Desc":"","Rating":"","Date":"","Setting":"","Url":"","Language":"","NowPlaying":"","Publisher":"","EncodedBy":"","ArtworkURL":"","TrackID":""}} 和 {"ret":0,"rid":60,"ID":2,"data":{"Ret":0,"Title":"","Artist":"","Genre":"","Copyright":"","Album":"","TrackNumber":"","Desc":"","Rating":"","Date":"","Setting":"","Url":"","Language":"","NowPlaying":"","Publisher":"","EncodedBy":"","ArtworkURL":"","TrackID":""}}

 

21) 取指定ID窗口音频信息,举例:
取时自动获得全部属性
请求:{"req":"VLC_AudioGet","rid":61,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":61,"ID":1,"data":{"Ret":0,"Mute":0,"Volume":100,"Track":"","TrackNumber":"","Channel":"","Desc":""}} 和 {"ret":0,"rid":61,"ID":2,"data":{"Ret":0,"Mute":"","Volume":"","Track":"","TrackNumber":"","Channel":"","Desc":""}}

 

22) 设置指定ID窗口音频信息,举例:
设置时不要求全部属性,只设置需要设置的
请求:{"req":"VLC_AudioPut","rid":62,"para":[{"ID":1,"Mute":0,"Volume":100,"Track":"","TrackNumber":"","Channel":"","Desc":""},{"ID":2,"Mute":"","Volume":""}]}
分别返回:{"ret":0,"rid":62,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":62,"ID":2,"data":{"Ret":0}}

 

23) 取指定ID窗口播放信息,举例:
取时自动获得全部属性
请求:{"req":"VLC_GetPlay","rid":63,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":63,"ID":1,"data":{"Ret":0,"IsPlay":1,"ItemCount":3,"CurrentItem":1}} 和 {"ret":0,"rid":63,"ID":2,"data":{"Ret":0,"IsPlay":1,"ItemCount":5,"CurrentItem":2}}

 

24) 指定ID窗口添加播放内容,举例:
Uri需要进行UrlEncode编码,Option可不设置用缺省值
请求:{"req":"VLC_AddPlay","rid":64,"para":[{"ID":1,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Name":"test","Option":":network-caching=300"},{"ID":2,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Name":"test","Option":":rtsp-tcp"}]}
分别返回:{"ret":0,"rid":64,"ID":1,"data":{"Ret":0,"Item":1}} 和 {"ret":0,"rid":64,"ID":2,"data":{"Ret":0,"Item":2}}

 

25) 指定ID窗口播放(指定多媒体),举例:
ItemId是序号,可缺省
请求:{"req":"VLC_Play","rid":65,"para":[{"ID":1,"ItemId":1},{"ID":2}]}
分别返回:{"ret":0,"rid":65,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":65,"ID":2,"data":{"Ret":0}}

 

26) 控制指定ID窗口播放器,举例:
Type可以是这些值:Pause,Play,Stop,StopAsync,Next,Prev,Clear,TogglePause
请求:{"req":"VLC_Control","rid":66,"para":[{"ID":1,"Type":"Pause"},{"ID":2,"Type":"Play"}]}
分别返回:{"ret":0,"rid":66,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":66,"ID":2,"data":{"Ret":0}}

 

27) 指定ID窗口移除多媒体内容,举例:
ItemId是当前已存在的序号
请求:{"req":"VLC_RemoveItem","rid":67,"para":[{"ID":1,"ItemId":1},{"ID":2,"ItemId":2}]}
分别返回:{"ret":0,"rid":67,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":67,"ID":2,"data":{"Ret":0}}

 

28) 指定ID窗口解析选项,举例:
请求:{"req":"VLC_Parse","rid":68,"para":[{"ID":1,"Option":"","Timeout":0},{"ID":2,,"Option":"","Timeout":0}]}
分别返回:{"ret":0,"rid":68,"ID":1,"data":{"Ret":0,"Status":0}} 和 {"ret":0,"rid":68,"ID":2,"data":{"Ret":0,"Status":0}}

 

29) 取指定ID窗口SubTitle信息,举例:
NameID指定时获取描述信息
请求:{"req":"VLC_GetSubTitle","rid":69,"para":[{"ID":1,"NameID":0},{"ID":2}]}
分别返回:{"ret":0,"rid":69,"ID":1,"data":{"Ret":0,"Spu":1,"SpuNumber":0,"Desc":""}} 和 {"ret":0,"rid":69,"ID":2,"data":{"Ret":0,"Spu":1,"SpuNumber":0}}

 

30) 设置指定ID窗口SubTitleSpu,举例:
请求:{"req":"VLC_PutSubTitle","rid":70,"para":[{"ID":1,"Spu":0},{"ID":2,"Spu":0}]}
分别返回:{"ret":0,"rid":70,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":70,"ID":2,"data":{"Ret":0}}

 

31) 取指定ID窗口视频信息,举例:
TrackID指定时获取描述信息
请求:{"req":"VLC_VideoGet","rid":71,"para":[{"ID":1,"TrackID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":71,"ID":1,"data":{"Ret":0,"FullScreent":0,"Width":0,"Height":0,"SubTitle":0,"Track":0,"TrackCount":0,"TeleText":0,"Scale":100,"AspectRatio":"","Crop":"","Desc":""}} 和 {"ret":0,"rid":71,"ID":2,"data":{"Ret":0,"Width":0,"Height":0,"SubTitle":0,"Track":0,"TrackCount":0,"TeleText":0,"Scale":100,"AspectRatio":"","Crop":""}}

 

32) 设置指定ID窗口视频信息,举例:
需要的才设置
请求:{"req":"VLC_VideoPut","rid":72,"para":[{"ID":1,"FullScreen":1,"Scale":100,"AspectRatio":0,"SubTitle":0,"TeleText":0,"Track":0},{"ID":2,"FullScreen":0}]}
分别返回:{"ret":0,"rid":72,"data":{"Ret":0}} 和 {"ret":0,"rid":72,"ID":2,"data":{"Ret":0}}

 

33) 切换指定ID窗口视频全屏,举例:
请求:{"req":"VLC_VideoToggleFullscreen","rid":73,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":73,"data":{"Ret":0}} 和 {"ret":0,"rid":73,"ID":2,"data":{"Ret":0}}

 

34) 切换指定ID窗口视频图文,举例:
请求:{"req":"VLC_VideoToggleTeletext","rid":74,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":74,"data":{"Ret":0}} 和 {"ret":0,"rid":74,"ID":2,"data":{"Ret":0}}

 

35) 取指定ID窗口字幕信息,举例:
Text指定时获取文字信息 Position指定时获取位置信息
请求:{"req":"VLC_MarqueeGet","rid":75,"para":[{"ID":1,"Text":1,"Position":1},{"ID":2}]}
分别返回:{"ret":0,"rid":75,"ID":1,"data":{"Ret":0,"Color":0,"Opacity":0,"Refresh":0,"Size":0,"Timeout":0,"X":0,"Y":"","Text":"","Position":""}} 和 {"ret":0,"rid":75,"ID":2,"data":{"Ret":0,"Color":0,"Opacity":0,"Refresh":0,"Size":0,"Timeout":0,"X":0,"Y":""}}

 

36) 设置指定ID窗口字幕信息,举例:
需要的才设置
请求:{"req":"VLC_MarqueePut","rid":76,"para":[{"ID":1,"Text":"Hello","Position":"","Color":0,"Opacity":0,"Refresh":0,"Size":0,"X":0,"Y":0},{"ID":2,"Opacity":50}]}
分别返回:{"ret":0,"rid":76,"data":{"Ret":0}} 和 {"ret":0,"rid":76,"ID":2,"data":{"Ret":0}}

 

37) 控制指定ID窗口字幕,举例:
请求:{"req":"VLC_MarqueeControl","rid":77,"para":[{"ID":1,"Enable":1},{"ID":2,"Enable":0}]}
分别返回:{"ret":0,"rid":77,"data":{"Ret":0}} 和 {"ret":0,"rid":77,"ID":2,"data":{"Ret":0}}

 

38) 指定ID窗口帧速控制工具,举例:
Mode为空时禁用
请求:{"req":"VLC_DeinterlaceControl","rid":78,"para":[{"ID":1,"Mode":"my_mode"},{"ID":2,"Mode":""}]}
分别返回:{"ret":0,"rid":78,"data":{"Ret":0}} 和 {"ret":0,"rid":78,"ID":2,"data":{"Ret":0}}

 

39) 动态改变分屏数量或播放内容
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.yuanmaster.com/DAHUARTSP.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":":network-caching=300"},{"ID":2,"Uri":"http://www.yuanmaster.com/DAHUARTSP.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":[]}}

 

40) 设置当前焦点播放窗口
ID是当前播放窗口序号,ID是从1开始,需要确保不越界
{"req":"VLC_SetSelect","rid":80,"para":{"ID":2}}
返回:{"ret":0,"rid":80,"ID":2,"data":{"Ret":1}}

 

41) 获取当前焦点播放窗口序号
{"req":"VLC_GetSelect","rid":81,"para":{}}
返回:{"ret":0,"rid":81,"ID":2,"data":{"Ret":1}}
ID为当前播放焦点窗口

 

42) 指定ID窗口截图
Type 指定图像类型,默认4(PNG) 可指定1(BMP)、3(JPG)
Count截取图数量,默认截取一张,Delay指定延迟毫秒数开始,Interval多张时间隔毫秒数
PathType 指定截图图片保存路径类型,0默认中间件临时目录,1操作系统桌面 2当前登录用户我的图片目录
多窗口播放情况下,只能指定某个窗口截图,不能同时指定多个窗口
请求:{"req":"VLC_VideoSnapshot","rid":82,"para":[{"ID":1,"Type":4,"Count":3,"Delay":1000,"Interval":200}]}
分别返回:{"ret":0,"rid":82,"data":{"Ret":0,"Img":[{"Size":0,"Width":0,"Height":0,"File":""}]}} 和 {"ret":0,"rid":80,"ID":2,"data":{"Ret":0,,"Img":[{"Size":0,"Width":0,"Height":0,"File":""}]}}

 

43) 设置RTSP流网络方式,HTTP还是TCP
{"req":"VLC_SetRtspTcp","rid":83,"para":{"Tcp":1}}
返回:{"ret":0,"rid":83,"data":{"Ret":1}}

 

44) 获取RTSP流网络方式,HTTP还是TCP
{"req":"VLC_GetRtspTcp","rid":84,"para":{}}
返回:{"ret":0,"rid":84,"data":{"Tcp":1}}

 

45) 请求退出当前连接的小程序
{"req":"VLC_Exit","rid":85,"para":{}}

   

5、VLC多媒体播放网页小程序接收的通知:
这些通知必须使用Web Socket连接到此小程序实际侦听的端口才能接收到。
A、ActiveX事件:

 

1) Idle state
{"event":"VLC_MediaPlayerNothingSpeciale","ID":1,"data":{}} 

 

2) Opening media
{"event":"VLC_MediaPlayerOpening","ID":1,"data":{}} 

 

3) Buffering media
{"event":"VLC_MediaPlayerBuffering","ID":1,"data":{"cache":0}} 

 

4) Media is playing
{"event":"VLC_MediaPlayerPlaying","ID":1,"data":{}} 

 

5) Media is paused
{"event":"VLC_MediaPlayerPaused","ID":1,"data":{}} 

 

6) Forward playback
{"event":"VLC_MediaPlayerForward","ID":1,"data":{}} 

 

7) Backward playback
{"event":"VLC_MediaPlayerBackward","ID":1,"data":{}} 

 

8) An error has been encountered
{"event":"VLC_MediaPlayerEncounteredError","ID":1,"data":{}} 

 

9) End of playback reached
{"event":"VLC_MediaPlayerEndReached","ID":1,"data":{}} 

 

10) Playback stopped
{"event":"VLC_MediaPlayerStopped","ID":1,"data":{}} 

 

11) Playback stop async done
{"event":"VLC_MediaPlayerStopAsyncDone","ID":1,"data":{}} 

 

12) Seek changed
{"event":"VLC_MediaPlayerSeekableChanged","ID":1,"data":{"seekable":0}} 

 

13) Pause setting changed
{"event":"VLC_MediaPlayerPausableChanged","ID":1,"data":{"pausable":0}} 

 

14) Media changed
{"event":"VLC_MediaPlayerMediaChanged","ID":1,"data":{}} 

 

15) Title changed
{"event":"VLC_MediaPlayerTitleChanged","ID":1,"data":{"title":0}} 

 

16) Length changed
{"event":"VLC_MediaPlayerLengthChanged","ID":1,"data":{"length":0}} 

 

17) Chapter changed
{"event":"VLC_MediaPlayerChapterChanged","ID":1,"data":{"chapter":0}} 

 

18) Number of vout changed
{"event":"VLC_MediaPlayerVout","ID":1,"data":{"count":0}} 

 

19) Audio muted
{"event":"VLC_MediaPlayerMuted","ID":1,"data":{}} 

 

20) Audio unmuted
{"event":"VLC_MediaPlayerUnmuted","ID":1,"data":{}} 

 

21) Audio volume changed
{"event":"VLC_MediaPlayerAudioVolume","ID":1,"data":{"volume":0}} 

 

22) Selected 选中分屏窗口序号通知
{"event":"VLC_Selected","ID":1,"data":{}} 

 

23) ToggleFullScreen 分屏窗口切换全屏通知
{"event":"VLC_ToggleFullScreen","ID":1,"data":{}} 

 

23) KeyDown
{"event":"VLC_KeyDown","ID":1,"data":{"KeyCode":0,"Shift":0}} 

 

24) KeyPress
{"event":"VLC_KeyPress","ID":1,"data":{"KeyCode":0}} 

 

25) KeyUp
{"event":"VLC_KeyUp","ID":1,"data":{"KeyCode":0,"Shift":0}} 

 

B、猿大师支持的事件通知:

 

1) VLC_FullScreen 小程序是否响应了热键全屏
{"event":"VLC_FullScreen","data":{"FullScreen":0}} FullScreen为当前是否全屏标记

 

2) Wrl_AppletExit 小程序退出通知
{"event":"Wrl_AppletExit","data":{"ID":1}}

 

6、其它
请求参数的JSON数据包,请确保是UTF-8无签名的编码。
更多接口请求说明,请参考安装目录中的文档TestWrl.txt、SDK包中的《猿大师开发者手册.doc》及《猿大师中间件安全解决方案》。
如还有疑问请直接联系客服。

收缩