猿大师播放器是基于跨浏览器的原生小程序系统-猿大师中间件网络高级版开发,底层调用ActiveX控件VlcOcx.dll(需安装VLC media player或搭配绿色版VLC桌面程序)可实现在网页中内嵌播放多路RTSP实时视频流。最低可用在Chrome 41、Firefox 50、Edge 80(Chromium内核)、360极速/安全、IE、Opera、Electron、Vivaldi、Brave、QQ等浏览器,也兼容运行于这些浏览器的最新版本,建议在Windows 7及以上版本使用,XP下VLC建议用3.0.3版。
猿大师播放器具有如下优点:
1、在支持主流版本浏览器的前提下,是当前市场中可实现低延迟(300毫秒)的成熟播放方案;
2、支持多路同时播放、动态切换播放源、支持回放、字幕、水印、录像及抓图,尤其是高分辨率视频或大屏播放体验好;
3、底层播放技术采用VLC的开放源代码方案,播放器后续服务有保障,播放格式兼容好,同时支持H.264和H.265无压力;
4、VLC网页播放小程序额外付费后可获得其源代码进行定制开发,自主可控;
5、支持海康威视、大华、华为等各厂家的摄像头,支持内网,只要能提供标准的RTSP流,都可以播放;
6、前端代码接口丰富、集成简单,支持VUE等主流框架,简单JS调用即可完成集成;
7、移动端可直接采用VLC开放源代码的APP来使用,无需单独开发,投入少见效快;
8、此技术方案可实现在原有技术体系下的平滑升级,降低了方案大改造带来的技术路线和延期交付风险,可节省大量研发成本。
1)、如果是exe的安装程序,请直接运行安装;
2)、如果是绿色版的程序包,请解压到磁盘某个目录后,双击“InstallWrl.bat”进行安装;
3)、安装完成时会启动猿大师中间件服务,在安装目录下的Data子目录有WrlService.txt日志文件输出运行情况。
说明:以下功能请通过Web Socket连接猿大师主服务(ws://localhost:83?sid=12345&flag=1)后可执行,如默认侦听端口不是83(关于如何配置侦听端口,请参考SDK包中的文档“猿大师开发者手册.pdf”),请在连接地址中指定端口号进行连接。
单屏全页面显示:http://test.yuanmaster.com/vlcwebfull.html
多屏局部显示:http://test.yuanmaster.com/VLCWebPlayer.html
如果您是VUE框架的,我们还有VUE框架页面测试,可以直接测试截图、录像、水印、字幕、多屏播放等功能。
网址:http://test.yuanmaster.com/VLC/#/
如还需兼容IE浏览器使用,网络版测试网页中 <object ID="WrlWS" CLASSID="CLSID:C0971B90-4513-4E2D-A0B6-15B915FE748A" width="0" height="0"></object>
的CLSID需要替换为:21ADE2E6-B4DD-4F3E-8BD5-9DDAD1785F3A
前端集成可参考以上测试网页进行,需要嵌入用到的JS脚本,另外脚本程序是完全开源的。
播放窗口选中状态时单击或按字母F即可全屏显示,全屏显示状态通过ESC、Windows按键、ESC或字母F取消,全屏切换会发送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:网页标题中的关键词
Url:加载小程序所在的网页实际地址,在网页中指定小程序的显示位置和大小,分屏多窗口播放地址和选项等,不建议使用了,建议改用Web参数
Flag掩码标记:1指定新标签加载(1和16都不指定时为当前页加载) 2小程序显示窗口边框 4不自动裁剪越界窗口 8自动适配网页高度和宽度显示 64启用Web参数 128防截屏 256强制显示到副屏 512允许同一网页加载多实例
Web:播放配置(新增方式),可代替Url使用,Flag值+64使用此配置,此命令中必须指定Left、Top、Width、Height的值
Version播放小程序版本,0在播放小程序中播放,1在独立进程中播放
ShowType 播放窗口分屏类型,默认1只显示一个播放窗口,支持1-22 24 25等多达20种多窗口播放
IframeX和IframeY分别为iframe嵌套的横竖偏移修正坐标
BarW和BarH分别是网页右侧和底部预留区域,ScrollTop为顶部滚动预留高度
小程序实际显示首先会基于Web或Url中指定的坐标和大小,再根据IframeX、IframeY、BarW、BarH设定的值做修正
Open :启动后第一个窗口自动播放的流地址或本地多媒体文件路径,斜杠\替换成/再传,也可以在Web中指定
注意:Open、Url、Web中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递 如非本地全路径,默认使用中间件程序Data子目录作为根目录使用
举例:
自动识别当前浏览器指定位置和大小启动:
{"req":"Wrl_VLCWebPlayer","rid":5,"para":{"Type":"0","Title":"VLC Web Player","Flag":66,"Left":20,"Top":230,"Width":480,"Height":320,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Version":"0","ShowType":4,"Open":"https://vjs.zencdn.net/v/oceans.mp4","Web":[{"ID":2,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Option":":rtsp-tcp"},{"ID":3,"Uri":"http://www.yuanmaster.com/Files/RTSP.mp4","Option":":file-caching=300"},{"ID":4,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/sub/av_stream","Option":":network-caching=200"}]}}
自动识别当前浏览器启动(充满网页区):
{"req":"Wrl_VLCWebPlayer","rid":5,"para":{"Type":"0","Title":"VLC Web Player","Flag":72,"Left":0,"Top":0,"Width":0,"Height":0,"IframeX":0,"IframeY":0,"BarW":0,"BarH":0,"ScrollTop":0,"Version":"0","ShowType":4,"Open":"http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/gear2/prog_index.m3u8","Web":[{"ID":2,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","Option":":rtsp-tcp"},{"ID":3,"Uri":"http://www.yuanmaster.com/Files/RTSP.mp4","Option":":file-caching=300"},{"ID":4,"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/sub/av_stream","Option":":network-caching=200"}]}}
当前页指定位置自动适配网页加载测试
http://test.yuanmaster.com/VLCWebPlayer.html
启动后会前后收到三个JSON数据包
A、{"ret":0,"rid":5,"data":{"ID":2}}
代表小程序WS侦听服务就绪
B、{"event":"Wrl_Listen","aid":2,"rid":5,"data":{"SID":"123","PID":"VLCWebPlayer","port":935}}
返回的侦听端口,可再建立一个Web Socket连接后,调用小程序中的相关功能,比如重新指定播放一个视频。
代表小程序创建成功,返回ID为当前小程序运行ID,通过此ID,可执行Wrl_AppletControl、Wrl_AppletScroll、Wrl_AppletResize等命令。
C、{"event":"Wrl_AppletOK","aid":2,"rid":5,"data":{"SID":"123","PID":"VLCWebPlayer","Port":935}}
由于依赖VLC桌面程序,所以可以提前调用以下接口获得VLC等播放器的安装情况,如未安装,可先提示下载安装
{"req":"Wrl_PlayerInfo","rid":1,"para":{}}
获得当前电脑VLC桌面播放器安装的情况,返回值
{"ret":0,"rid":1,"req":"Wrl_PlayerInfo","data":{"Info":[{"Type":1,"X64":1,"Ver":"3.0.17.4","Path":"C:/Program Files/VideoLAN/VLC/vlc.exe"}]}}
Type 1 代表VLC X64 代表是否为64位版本 Ver 代表文件版本信息 Path 安装路径
2)、请求控制VLC网页播放器:
当前端不再需要小程序时可指定关闭,或者显示/隐藏及全屏显示等
ID为Wrl_VLCWebPlayer启动小程序时返回的ID值,Code代表控制类型掩码:1正常关闭 128强制迅速关闭 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":".jpg"}}
8)、请求缩放内嵌网页小程序,用于浏览器网页按比例缩放,一般不需要处理:
ID为启动小程序时返回JSON中的ID值,不指定Scale时,获取当前小程序所用的缩放百分比,一般和系统缩放比例一致
{"req":"Wrl_AppletScale","rid":11,"para":{"ID":1,"Scale":120}}
1)、请求安装VLC网页播放器
请在测试网页输入框中,输入如下请求,然后点击发送,完成安装:
{"req":"Plugin_Install","rid":1,"para":{"Name":"VLC网页播放器","PID":"VLCWebPlayer","Date":"2023-09-26","Desc":"跨浏览器的VLC网页播放小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中直接内嵌使用,可播放多路海康及大华等设备的实时视频","DownAddr":"http://local.zorrosoft.com/Files/Net/VlcPlayerApplet.pid","MD5":"169B33E2AE2423E48EBD21A1A9A72019","Version":"2.2.11.1","Size":8126464,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"9E658115064B116657DE115CFC7BB6F4C338070BD45DD267C3648A2F2BD9016022D9D3E451508A88E2CA9E41B2D89345AA2AFA720E69FC617C130BFDC49F987B5F8EB3E429838A8EF13009D1A90DA1C6BB9D94DA89BA0D8FC1A7497C36409464E4CFD569E6E3739DA3AAC1B51A4035C7E57D5E3C2AF78811851C4F0BF0066EF90F98B1BE9BD2CAFB7E29C8025DA358E27BBED007778BF78F6981F640AF80823E0836081D083D396853C6D9A895150A011082D51B9432F8B5EEE5B9D60DFDFD59B4BD8E8F3346743BD4A22E74A02D1A61AE6E8E33243393828F9E83CE23140F9EF9D6DE7F2A001DF7FC3D008CA022CAB9A50A5373407D9355ACB695C05A1F6A04"}}
启动安装后,会不断收到安装进度直到安装结束。
2)、请求升级VLC网页播放器:
{"req":"Plugin_Update","rid":1,"para":{"Name":"VLC网页播放器","PID":"VLCWebPlayer","Date":"2023-09-26","Desc":"跨浏览器的VLC网页播放小程序,支持在Chrome、Edge、Firefox、IE、Oprea、360、QQ等最新版本浏览器网页中直接内嵌使用,可播放多路海康及大华等设备的实时视频","DownAddr":"http://local.zorrosoft.com/Files/Net/VlcPlayerApplet_Update.pid","MD5":"A86341344E12D7E6C45F92BE03AE1F8C","Version":"2.2.11.1","Size":8126464,"HideIns":0,"Type":8,"Cookie":"","Auth":"","TK":"0B7BAB6419265A135E0E3961A385E04827FABF3EFA1C38260149DD4683BF274BCCF677ABFB959B379FE74F7B48A3DF92422C9A7C024F1CE0A12A81FA3ACBDDC04A88DEAD37597FF36D2E25FD390B7F2546FC9FDCA45652CA7016D38AF855B7FF88A75A8E17AB9D3F5FE21B5419928B50DB220861474FB1EB4BA0497F29CEF6C506EC8CF31933A7ED2F2D6C9EFD6A336094CC44C0971EFC91F2E7D846CA11F0291DE2063523325CF3AB30030F58EB04AD4874F695DFDA15D89A3F42DD092A7B788CD92D82891C513E29D7388868A70775390F61A37DAC3D440C081FC37C4E3843D9F026C7ED1104EBAFAB22F19694E1BD6CB46ED2B47D5CD51A7F4A5C9319CF55"}}
以上安装和升级的JSON请求包,可能因版本升级导致内容不同,如遇安装或升级时报错,请联系客服获取最新的请求包。
3)、请求卸载VLC网页播放器:
正式版需要添加TK校验,具体规则请参考SDK包中文档“猿大师中间件安全解决方案.doc”,可在SDK包中的打包程序ZbaPackage.exe的中间件维护生成带TK的请求。
{"req":"Plugin_Remove","rid":3,"para":{"PID":"VLCWebPlayer","Type":8}}
(接口说明:https://wiki.videolan.org/Documentation:WebPlugin ),先根据Wrl_VLCWebPlayer请求启动后返回的端口号,针对此端口新建一个WebSocket连接后可执行如下指令:
A、ActiveX接口功能请求:
支持创建多个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}]}
BackColor返回的是长整型(COLORREF)
分别返回:{"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(背景色),举例:
BackColor可用长整型(COLORREF),也可以用#000000这样的颜色值
请求:{"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窗口推送信息屏蔽掩码,举例:
请求:{"req":"VLC_GetBlockFlag","rid":57,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":57,"ID":1,"data":{"Ret":0,"BlockFlag":0}} 和 {"ret":0,"rid":57,"ID":2,"data":{"Ret":0,"BlockFlag":0}}
18) 设置指定ID窗口推送信息屏蔽掩码,举例:
由于以下几种信息通知比较多,所以增加阻止通知设置,比如阻止鼠标移动和位置通知,就设置9
1阻止鼠标移动通知 2阻止时间变化通知 4阻止缓存通知 8阻止进度百分比通知
请求:{"req":"VLC_PutBlockFlag","rid":58,"para":[{"ID":1,"BlockFlag":0},{"ID":2,"BlockFlag":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可不设置用缺省值 Uri如非本地全路径,默认使用中间件程序Data子目录作为根目录使用
请求:{"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(播放暂停),Continue(播放继续),Play(开始播放),Stop(停止播放),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,"Status":4}} 和 {"ret":0,"rid":66,"ID":2,"data":{"Ret":0,"Status":3}}
返回的Status代表播放状态,定义参考libvlc_state_t
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窗口视频信息,举例:
需要的才设置 FullScreen设置是否全屏显示,Scale比例 AspectRatio宽高尺寸 SubTitle子标题
请求:{"req":"VLC_VideoPut","rid":72,"para":[{"ID":1,"FullScreen":1,"Scale":100,"AspectRatio":"","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}}
设置充满指定窗口大小显示:{"req":"VLC_VideoPut","rid":72,"para":[{"ID":1,"Scale":0,"AspectRatio":"480:320"}]}
33) 切换指定ID窗口视频全屏,一次只能请求一个分屏窗口,举例:
请求:{"req":"VLC_VideoToggleFullscreen","rid":73,"para":[{"ID":1}]}
分别返回:{"ret":0,"rid":73,"ID":1,"data":{"Ret":0}}
34) 切换指定ID窗口视频图文,举例:
请求:{"req":"VLC_VideoToggleTeletext","rid":74,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":74,"ID":1,"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窗口字幕信息,举例:
指定的参数,需要的才设置,必须视频开始播放才能设置
Text 文字内容
Opacity 透明度 0-256 0完全透明 256完全不透明
Position 显示位置有center left right top bottom top-left top-right bottom-left bottom-right 不指定时由X和Y坐标决定
X 和 Y分别指定文字开始坐标
Timeout 超时
Color 颜色 可用长整型(COLORREF),也可以用#000000这样的颜色值
Size 字体大小
请求:{"req":"VLC_MarqueePut","rid":76,"para":[{"ID":1,"Text":"Hello","Position":"TOP","Timeout":0,"Color":"16777215","Opacity":128,"Refresh":1,"Size":50,"X":50,"Y":50},{"ID":2,"Opacity":256}]}
分别返回:{"ret":0,"rid":76,"ID":1,"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,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":77,"ID":2,"data":{"Ret":0}}
38) 指定ID窗口帧速控制工具,举例:
Mode为空时禁用,取值有blend bob discard linear mean x yadif yadif2x phosphor ivtc auto
请求:{"req":"VLC_DeinterlaceControl","rid":78,"para":[{"ID":1,"Mode":"my_mode"},{"ID":2,"Mode":""}]}
分别返回:{"ret":0,"rid":78,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":78,"ID":2,"data":{"Ret":0}}
39) 动态改变分屏数量或播放内容
ShowType 指定分屏数量,如果不变就不设置
ForceDestroy VLC4.0且独立进程播放时默认1,其它时候默认0,指定0时切换播放不销毁原有控件
Play 重新指定播放内容:Uri中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递 Uri如非本地全路径,默认使用中间件程序Data子目录作为根目录使用
请求范例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/Files/RTSP.mp4","Name":"BrowserApplet2","Option":":file-caching=300"}]}}
请求范例3:{"req":"VLC_ChangePlay","rid":79,"para":{"ShowType":3,"ForceDestroy":0,"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.yuanmaster.com/Files/RTSP.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,不支持BASE64编码内容)、3(JPG)
Base64指定为1时代表返回BASE64编码的图像内容
AutoDel设置1 Base64为1时生效,自动删临时生成的图片文件,不删除设置0
Count截取图数量,默认截取一张,Delay指定延迟毫秒数开始,Interval多张时间隔毫秒数
FileName 指定截图文件名称,中文等需要先进行UrlEncode编码,可缺省使用默认值
CustomPath 指定截图保存路径,中文等需要先进行UrlEncode编码,不指定时由PathType决定
PathType 指定截图图片保存路径类型,0默认临时目录,1操作系统桌面 2当前登录用户我的图片目录 3中间件数据目录
多窗口播放情况下,只能指定某个窗口截图,不能同时指定多个窗口
请求1:{"req":"VLC_VideoSnapshot","rid":82,"para":[{"ID":1,"Type":3,"PathType":3,"Count":3,"Base64":1,"AutoDel":1,"Delay":1000,"Interval":200}]}
请求2: {"req":"VLC_VideoSnapshot","rid":82,"para":[{"ID":1,"Type":3,"Count":3,"CustomPath":"D:/Zorro","FileName":"TestFileName"}]}
分别返回:{"ret":0,"rid":82,"data":{"Ret":0,"Img":[{"Size":0,"Width":0,"Height":0,"File":""}]}} 和 {"ret":0,"rid":82,"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_PutFillWnd","rid":85,"para":[{"ID":1,"FillWnd":1},{"ID":2,"FillWnd":0}]}
分别返回:{"ret":0,"rid":85,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":85,"ID":2,"data":{"Ret":0}}
46) 获取播放内容是否充满窗口
{"req":"VLC_GetFillWnd","rid":86,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":86,"ID":1,"data":{"Ret":0,"FillWnd":1}} 和 {"ret":0,"rid":86,"ID":2,"data":{"Ret":0,"FillWnd":0}}
47) 获取水印显示信息
{"req":"VLC_GetShowLogo","rid":87,"para":[{"ID":1},{"ID":2}]}
分别返回:{"ret":0,"rid":87,"ID":1,"data":{"Ret":0,"File":"","Position":"","Delay":0,"Repeat":0,"Opacity":0,"X":0,"Y":0,"Enable":0}} 和 {"ret":0,"rid":87,"ID":2,"data":{"Ret":0}}
48) 设置水印显示
ID为窗口序号
File 水印文件路径,如有特殊符号请先进行UrlEncode,为空默认用小程序目录的Logo.png
Code 水印图片BASE64编码,可替代File
Position 显示位置有center left right top bottom top-left top-right bottom-left bottom-right,默认undefined未定义,显示位置有坐标X和Y控制
Delay 水印间隔图像时间为毫秒 0 - 60000 默认1000
Repeat 循环 水印动画的循环数量 -1继续(默认) 0关闭
Opacity 透明度 (数值介于 0(完全透明) 与 255(完全不透明,默认)
X 水印X坐标
Y 水印Y坐标
{"req":"VLC_PutLogoShow","rid":88,"para":[{"ID":1,"File":"VLC.png" ,"Delay":20,"Repeat":-1,"Opacity":128,"X":100,"Y":100},{"ID":2,"Position":" center ","Delay":100,"Repeat":-1,"Opacity":256,"X":200,"Y":0}]}
分别返回:{"ret":0,"rid":88,"ID":1,"data":{"Ret":0,"Enable":1}} 和 {"ret":0,"rid":88,"ID":2,"data":{"Ret":0,"Enable":0}}
49) 水印显示控制
ID为窗口序号 Flag为1代表启用,0代表禁用
{"req":"VLC_LogoControl","rid":89,"para":[{"ID":1,"Flag":1},{"ID":2,"Flag":0}]}
分别返回:{"ret":0,"rid":89,"ID":1,"data":{"Ret":0,"Enable":1}} 和 {"ret":0,"rid":89,"ID":2,"data":{"Ret":0,"Enable":0}}
50) 对指定视频流录像到文件,不支持同时录制多个
Type为录像方式 0:VLC 1:ffmpeg 指定1时在播放小程序子目录存放ffmpeg程序
ID为分屏窗口,此分屏窗口必须有可播放的视频
Url为RTSP流地址,不指定ID和Url时取当前焦点窗口流的
File为录像目标文件不指定时自动生成 Second为录制限时时间(秒),0代表由前端指定停止
Para为录像参数 使用VLC时默认为vcodec=h264 使用ffmpeg时默认为-vcodec libx264
指定Second时为录制指定秒数的录像,不指定时需要主动调用VLC_StopRecord结束录像
{"req":"VLC_RecordFile","rid":90,"para":{"ID":1,"Type":0,"File":"D:/Zorro/test.mp4","Second":30}}
或
{"req":"VLC_RecordFile","rid":90,"para":{"Url":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/main/av_stream","File":"D:/Zorro/test.mp4","Second":30}}
返回:{"ret":0,"rid":90,"data":{"Ret":0,"PID":1}}
51) 停止录像
传入指定录像时返回的PID
{"req":"VLC_StopRecord","rid":91,"para":{"PID":1}}
File为录像文件路径,Size为录像文件大小
返回:{"ret":0,"rid":91,"data":{"Ret":0,"File":"D:/Zorro/test.mp4","Size":321}}
52) 获取输入源信息
Title为1支持获取标题更多信息,标题中支持获取指定Track的描述
Chapter为1支持获取章节更多信息 章节中可指定TitleID获取TrackCount,再指定ChapterID获得章节描述
{"req":"VLC_GetInputInfo","rid":92,"para":[{"ID":1,"Title":1},{"ID":2,"Chapter":1}]}
分别返回:{"ret":0,"rid":92,"ID":1,"data":{"Ret":0,"InputInfo":{"Status":3,"HasVout":1,"Len":0.0,"Pos":0.0,"Time":9667.0,"Rate":1.0,"Fps":25.000,"Title":{"Count":0,"Track":0,"Desc":""},"Chapter":{}}}}
和 {"ret":0,"rid":92,"ID":2,"data":{"Ret":0,"InputInfo":{"Status":3,"HasVout":1,"Len":117078.0,"Pos":0.075,"Time":8854.0,"Rate":1.0,"Fps":9.982,"Title":{},"Chapter":{"Count":0,"Track":0,"TrackCount":0,"Desc":""}}}}
返回值字段含义:
HasVout:当显示视频时返回1
State:作为枚举给出的输入链的当前状态 0闲 1打开 2缓冲 3播放 4暂停 5停止 6已结束 7错误
Rate:输入速度为float(1.0为正常速度,0.5为半速,2.0为两倍快)
Len:输入文件的长度,以毫秒为单位 返回0的是实时流或剪辑,其长度不能确定
Fps:以秒为单位返回的帧数
Pos:在多媒体流项目中播放位置,[0.0 - 1.0]
Time:以毫秒为单位给出的绝对位置,此属性可用于通过流来查找
53) 设置输入源信息
Pos是位置 Time是时间 Rate是速度 TitleTrack标题轨
{"req":"VLC_PutInputInfo","rid":93,"para":[{"ID":1,"Pos":0.075,"Time":9667.0,"Rate":1,"TitleTrack":0},{"ID":2,"Rate":1}]}
分别返回:{"ret":0,"rid":93,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":93,"ID":2,"data":{"Ret":0}}
54) 操作章节信息
Track 章节跟踪。该属性将整数作为输入值[0-0.65535]
Opt是操作类型,1是前进 2是后退
{"req":"VLC_PutChapterInfo","rid":94,"para":[{"ID":1,"Track":0},{"ID":2,"Opt":1}]}
分别返回:{"ret":0,"rid":94,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":94,"ID":2,"data":{"Ret":0}}
55) 设置状态信息显示
Text为空时或直接无Status节点时代表取消状态显示文字,打开视频播放时,由Config.json中的Status节点配置状态,前端可对状态显示文字进行更改
{"req":"VLC_StatusShow","rid":95,"para":[{"ID":1, "Status":{"Text":""}
},{"ID":2, "Status":{"Text":"播放异常,请检查流地址或数据是否合法!","Color":"#00FF7F","Opacity":255,"Size":16,"Name":"宋体"}
}]}
分别返回:{"ret":0,"rid":95,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":94,"ID":2,"data":{"Ret":0}}
56) 播放失败时(网络错误)尝试恢复设置
Count 尝试次数,大于0有效 Second 尝试间隔秒数,最低1秒
{"req":"VLC_PutErrTry","rid":96,"para":[{"ID":1,"Count":3,"Second":6},{"ID":2,"Count":5,"Second":15}]}
分别返回:{"ret":0,"rid":96,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":96,"ID":2,"data":{"Ret":0}}
57) 添加轮换播放内容,一般用于大屏巡检等
比如现在4分屏播放,执行后1分屏播放添加的轮换内容,原来1、2、3分屏播放内容切换到2、3、4分屏窗口播放
Uri中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递 Uri如非本地全路径,默认使用中间件程序Data子目录作为根目录使用
请求:{"req":"VLC_AddOrderPlay","rid":97,"para":{"Uri":"rtsp://wzh:test123456@192.168.1.8:554/h264/ch1/sub/av_stream","Name":"OrderPlay","Option":":rtsp-tcp"}}
返回:{"ret":0,"rid":97,"data":{"Ret":0}}
58) 请求显示下一帧 执行后播放暂停,效果类似在VLC桌面程序中按快捷键E的效果
Count 为帧数量,不指定时默认为1 不支持实时流,支持文件和回放流支持
{"req":"VLC_NextFrame","rid":98,"para":[{"ID":1,"Count":10},{"ID":2,"Count":10}]}
分别返回:{"ret":0,"rid":98,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":98,"ID":2,"data":{"Ret":0}}
59) 取小程序Config.json中的配置内容,举例:
请求:{"req":"VLC_GetConfig","rid":99,"para":{}}
返回:{"ret":0,"rid":99,"data":{"COM": "axvlc.dll","Caching":300,"RTSPTCP":1,"ToolBar":1,"FillWnd":1,"AutoLoop":1,"SelfGPU":1,"Mute":0,"BlockFlag":7,"PercentTime":300,"ErrTryCount":3,"ErrTrySecond":6,"BackColor":"#000000","PORT": 930}}
60) 设置小程序Config.json中的配置内容,举例:
请求:{"req":"VLC_SetConfig","rid":100,"para":{"COM": "axvlc.dll","Caching":300,"RTSPTCP":1,"ToolBar":1,"FillWnd":1,"AutoLoop":1,"SelfGPU":1,"Mute":0,"BlockFlag":7,"PercentTime":300,"ErrTryCount":3,"ErrTrySecond":6,"BackColor":"#000000","PORT": 930}}
返回:{"ret":0,"rid":100,"data":{"Ret":0}}
此设置仅对本次播放实例有效,不会实际保存到文件中
61)HTTP同步方式上传视频到服务器或下载视频到本地,上传主要用于上传截图和录像到服务器保存
Type 1同步上传 0下载(支持异步,设置Asyn为1)
Agent、Cookie及Auth Cookie可传浏览器中的Cookie或通过Auth授权验证上传权限,默认为空,非空时需要先做UrlEnocde编码
Local 上传文件本地路径或下载文件保存路径,如果不指定默认用当前打开文档,需要做UrlEncode编码
Url 上传或下载的地址,需要做UrlEncode编码
Type为1时,可增加参数Para,对应POST数据包中需要传递的参数param 默认上传文件名为upfile,否则可通过NodeName设置自己的文件参数名称
Type为0时,可增加参数MD5及FileSize,下载文件的哈希值及大小,用于校验下载文件的完整性,可默认空或0
{"req":"VLC_NetFile","rid":101,"para":{"Type":1,"Agent":"","Cookie":"","Auth":"","Para":"","Local":"","Url":"http://zorrosoft.com/wp-admin/admin-ajax.php"}}
返回:{"ret":0,"rid":35,"data":{"Ret":"0","Info":{}}} Info为上传到服务器返回的信息
62) 指定多个同类视频文件进行合并,合并结果通过事件通知返回
Type 合并引擎 1:FFMpeg
Src 需要合并的原视频路径数组 文件名及路径需要先做UrlEncode编码
Out 合并生成目标 如设置了需要先做UrlEncode编码,没设置自动在默认路径生成一个mp4视频文件名
举例:
请求:{"req":"VLC_MergeVideo","rid":102,"para":{"Type":1,"Src":["d:/Zorro/test5.mp4","d:/Zorro/test6.mp4"],"Out": "dest.mp4"}}
返回:{"ret":0,"rid":102,"data":{"Ret":0}}
事件通知合并结果
aid:对应VLC_MergeVideo的请求rid Size:合并目标视频文件大小 PID:合并进程 File:合并最终形成的目标视频文件
{"event":"VLC_MergeOK","aid":102,"PID":0,"data":{"Ret":0,"File":"dest.mp4","Size":0}}
63) 指定分屏添加轮播内容,一般用于大视频被切片时依次轮播
比如1分屏正在播放Url地址内容(要求是文件或回放视频),当播放结束时马上切换到轮播内容,切换时没有延迟
Uri中如果有特殊字符= & 双引号或中文等,需要用URL编码处理后传递 Uri如非本地全路径,默认使用中间件程序Data子目录作为根目录使用
请求:{"req":"VLC_AddPreparePlay","rid":103,"para":[{"ID":1,"Uri":"d:/zorro/play.mp4","Name":"PreparePlay","Option":":rtsp-tcp"}]}
返回:{"ret":0,"rid":103,"data":{"Ret":0}}
64) 设置指定分屏窗口是否禁用双击全屏功能
DisableDBFull 设置1时禁用,默认不禁用
{"req":"VLC_PutDisableDBFull","rid":104,"para":[{"ID":1,"DisableDBFull":1},{"ID":2,"DisableDBFull":0}]}
分别返回:{"ret":0,"rid":104,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":104,"ID":2,"data":{"Ret":0}}
65) 设置指定分屏窗口是否启用播放列表
EnablePlayList 设置1时启用,默认禁用
{"req":"VLC_PutEnablePlayList","rid":105,"para":[{"ID":1,"PlayList":1},{"ID":2,"PlayList":0}]}
分别返回:{"ret":0,"rid":105,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":105,"ID":2,"data":{"Ret":0}}
70) 设置指定ID窗口下方文字信息,定制功能,举例:
指定的参数,需要的才设置
Text 文字内容,必须参数
Color 颜色 可用长整型(COLORREF),也可以用#000000这样的颜色值,默认白色
Size 字体大小,默认18
请求:{"req":"VLC_CustomText","rid":110,"para":[{"ID":1,"Text":"Hello1","Color":"16777215","Size":50},{"ID":2,"Text":"Hello2"},{"ID":3,"Text":"Hello3"},{"ID":4,"Text":"Hello4"}]}
分别返回:{"ret":0,"rid":110,"data":{"Ret":0}}
71) 指定ID窗口叠加网页中的渲染内容,Widows 8及以上版本操作系统正常支持,本机需要安装Microsoft Edge WebView2 Runtime
Url为透明网页地址,如有特殊符号请先进行UrlEncode,设置为空字符串代表取消叠加
Alpha 透明度(0-255) 默认255不透明,Windows 7系统及以下版本不支持透明
Rect节点设置叠加窗口位置和大小,不设置时代表全部区域,E代表边距默认1,X/Y/W/H分别代表叠加窗口在分屏窗口中显示的起始点和宽高,P为显示位置类型,大于0时替代X和Y,1左上 2右上 3左下 4右下
{"req":"VLC_FloatWebInfo","rid":120,"para":[{"ID":1,"Url":"https://output.jsbin.com/dopavun"},{"ID":2,"Alpha":70,"Url":"https://output.jsbin.com/dopavun"}]}
{"req":"VLC_FloatWebInfo","rid":120,"para":[{"ID":1,"Url":"https://output.jsbin.com/dopavun","Rect":{"X":0,"Y":0,"P":0,"W":300,"H":300}}]}
返回:{"ret":0,"rid":120,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":120,"ID":2,"data":{"Ret":0}}
72) 指定ID窗口叠加网页注入脚本运行
Script为脚本内容,请先进行UrlEncode,设置为空字符串代表取消叠加
Init 初始化
{"req":"VLC_FloatWebInjectScript","rid":112,"para":[{"ID":1,"Init":0,"Script":"window.getComputedStyle(document.body).backgroundColor"},{"ID":2,"Init":0,"Url":"if%20(window.parent%20!%3D%3D%20window.top)%7B%0A%09delete%20window.open%3B%0A%7D"}]}
返回:{"ret":0,"rid":112,"ID":1,"data":{"Ret":0}} 和 {"ret":0,"rid":112,"ID":2,"data":{"Ret":0}}
这些通知必须使用Web Socket连接到此小程序实际侦听的端口才能接收到。
A、ActiveX事件:
文档参考:https://wiki.videolan.org/Documentation:WebPlugin
1) vlc is in idle state doing nothing but waiting for a command to be issued 播放器空闲中
ID是分屏序号 aid是播放实例ID 下同
{"event":"VLC_MediaPlayerNothingSpeciale","ID":1,"rid":1,"data":{}}
2) vlc is opening an media resource locator (MRL) 正在打开播放源
{"event":"VLC_MediaPlayerOpening","ID":1,"data":{}}
3) vlc is buffering 播放器正在缓存数据 通过VLC_PutBlockFlag设置掩码4可阻止通知,默认不阻止
{"event":"VLC_MediaPlayerBuffering","ID":1,"rid":1,"data":{"cache":0}}
4) vlc is playing a media 正在播放中,第一次WS连接过来会收到此通知,也可以通过调用VLC_GetPlay获得IsPlay是否播放状态
{"event":"VLC_MediaPlayerPlaying","ID":1,"rid":1,"data":{"W":1530,"H":1078}}
W和H分别为视频的高度和宽度
5) vlc is in paused state 播放暂停状态
{"event":"VLC_MediaPlayerPaused","ID":1,"rid":1,"data":{}}
6) vlc is fastforwarding 快进播放
{"event":"VLC_MediaPlayerForward","ID":1,"rid":1,"data":{}}
7) vlc is going backwards 后退播放
{"event":"VLC_MediaPlayerBackward","ID":1,"rid":1,"data":{}}
8) vlc has encountered an error and is unable to continue 出现错误不能继续,前端需捕获处理如执行重新播放等
{"event":"VLC_MediaPlayerEncounteredError","ID":1,"rid":1,"data":{}}
9) time has changed 时间改变 通过VLC_PutBlockFlag设置掩码2可阻止通知,默认不阻止,可通过持续监听此通知判断播放是否正常状态
{"event":"VLC_MediaPlayerTimeChanged","ID":1,"rid":1,"data":{"time":0}}
10) media position has changed 位置改变 通过VLC_PutBlockFlag设置掩码8可阻止通知,默认不阻止
同时返回总长度和当前播放时间
{"event":"VLC_MediaPlayerPositionChanged","ID":1,"rid":1,"data":{"position":0,"length":0,"time":0}}
11) Play stopped 播放停止
{"event":"VLC_MediaPlayerStopped","ID":1,"rid":1,"data":{}}
12) Play stop async done 异步停止播放完成
{"event":"VLC_MediaPlayerStopAsyncDone","ID":1,"rid":1,"data":{}}
13) media seekable flag has changed (true means media is seekable, false means it is not)
{"event":"VLC_MediaPlayerSeekableChanged","ID":1,"rid":1,"data":{"seekable":0}}
14) media pausable flag has changed (true means media is pauseable, false means it is not)
{"event":"VLC_MediaPlayerPausableChanged","ID":1,"rid":1,"data":{"pausable":0}}
15) media has changed 播放源改变
{"event":"VLC_MediaPlayerMediaChanged","ID":1,"rid":1,"data":{}}
16) chapter has changed (DVD/Blu-ray) 章节已更改(DVD/蓝光)
{"event":"VLC_MediaPlayerChapterChanged","ID":1,"rid":1,"data":{"chapter":0}}
17) the number of video output has changed 视频输出数量发生变化
{"event":"VLC_MediaPlayerVout","ID":1,"rid":1,"data":{"count":0}}
18) audio volume was muted 静音
{"event":"VLC_MediaPlayerMuted","ID":1,"rid":1,"data":{}}
19) audio volume was unmuted 取消静音
{"event":"VLC_MediaPlayerUnmuted","ID":1,"rid":1,"data":{}}
20) audio volume has changed 音量改变
{"event":"VLC_MediaPlayerAudioVolume","ID":1,"rid":1,"data":{"volume":0}}
21) KeyDown 按键按下
{"event":"VLC_KeyDown","ID":1,"rid":1,"data":{"KeyCode":0,"Shift":0}}
22) KeyPress 按键码
{"event":"VLC_KeyPress","ID":1,"rid":1,"data":{"KeyCode":0}}
23) KeyUp 按键弹起
{"event":"VLC_KeyUp","ID":1,"rid":1,"data":{"KeyCode":0,"Shift":0}}
24) MouseMove 鼠标移动通知 通过VLC_PutBlockFlag设置掩码1可阻止通知,默认阻止
{"event":"VLC_MouseMove","ID":1,"rid":1,"data":{"Button":0,"Shift":0,"X":0,"Y":0}}
25) MouseDown 鼠标按下
{"event":"VLC_MouseDown","ID":1,"rid":1,"data":{"Button":0,"Shift":0,"X":0,"Y":0}}
26) MouseUp 鼠标弹起
{"event":"VLC_MouseUp","ID":1,"rid":1,"data":{"Button":0,"Shift":0,"X":0,"Y":0}}
/// 以下几个非ActiveX控件事件通知
27) Selected 选中分屏窗口序号通知
{"event":"VLC_Selected","ID":1,"rid":1,"data":{}}
28) ToggleFullScreen 某个分屏窗口切换全屏通知
{"event":"VLC_ToggleFullScreen","ID":1,"rid":1,"data":{}}
29) 录像结束通知(限时录制时发出)
{"event":"VLC_StopRecord","PID":1,"rid":1,"data":{"Ret":0,"File":"D:/Zorro/test.mp4","Size":321}}
PID是开始录像时返回的ID
30) 定制图标被点击
CID 标识窗口序号
{"event":"VLC_CustomClicked","CID":1,"rid":1,"data":{}}
31) 叠加网页导航结果通知
{"event":"VLC_WebNavResult","ID":1,"rid":1,"aid":1,"data":{"Result":""}]}}
Result UrlEncode后的请求结果
32) 叠加网页注入脚本结果通知
{"event":"VLC_WebScriptResult","ID":1,"rid":1,"aid":1,"data":{"Result":""}]}}
Result UrlEncode后的请求结果
B、支持的事件通知:
1) VLC_FullScreen 播放小程序是否响应了热键全屏
{"event":"VLC_FullScreen","rid":1,"data":{"FullScreen":0}} FullScreen为当前是否全屏标记
2) Wrl_AppletExit 小程序退出通知
{"event":"Wrl_AppletExit","data":{"ID":1}} ID小程序实例ID
请求参数的JSON数据包,请确保是UTF-8无签名的编码。
更多接口请求说明,请参考安装目录中的文档TestWrl.txt、SDK包中的“猿大师开发者手册.pdf”及“猿大师中间件安全解决方案.pdf”。