EasyPlayerPro与EasyPlayer-RTSP新增ocx多窗口播放功能,这里以EasyPlayerPro为例,使用方法如下:
- 打开播放器文件夹,进入Bin/C++目录,可以看到reg.bat这个文件,
以管理员身份运行
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/1eeba3c7e59f9a168d9ea6157d4cc3ef.png)
- 成功运行程序后,找到ocx mutiplayer.html文件,右键选择打开方式,
使用ie浏览器打开
- ie浏览器会弹窗阻止javascript程序运行,看不到视频窗口,点击允许阻止的内容
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/238d7b7418a9968e52bc58bd0270dfbd.png)
- 进入播放页面,各项目功能如下:
![这里写图片描述](https://i-blog.csdnimg.cn/blog_migrate/83ea8dcd59920b7d8a0a2a40ee9eba58.png)
- 代码分析如下:
- 播放窗口,是一个OBJECT标签,,可以控制宽高,多窗口页面共4个OBJECT标签,代表4个窗口
<OBJECT id="obj1" WIDTH=640px HEIGHT=480px CLASSID="CLSID:C826A1CE-34E6-4BB1-B844-681E7AC98D9A">
- html代码中,RTSP URL、RenderFormat、缓存是输入框,取其value值,其余皆是复选框,使用三元运算符判断有无被选中
RTSP URL: <input type="text" name="url" id="url" VALUE="rtmp://live.hkstv.hk.lxdns.com/live/hks"/>
缓存:<input type="text" name="cache" id="cache" size=25 value ="3"/>
按比例显示:<input type="text" name="showtoscale" id="showtoscale" size=25 value ="1"/><br>
显示码率信息:<input type="checkbox" name="showsatic" id="showsatic" checked="checked"/>
RenderFormat: <input type="checkbox" name="rendertype" id="rendertype" VALUE="0" checked="checked"/>
UDP Over TCP: <input type="checkbox" name="rtpovertcp" id="rtpovertcp" size=25 value="1" checked="checked"/>
采用硬解码:<input type="checkbox" name="harddecode" id="harddecode" checked="checked"/>
播放声音:<input type="checkbox" name="playsound" id="playsound" type="checked"/>
function start(url, rendertype, rtpovertcp, cache, showtoscale, playsound, showsatic, startNumber) {
var obj = document.getElementById("obj" + startNumber);
obj.Start(url, rendertype, rtpovertcp, cache, showtoscale, playsound, showsatic);
}
function startplay(i) {
var obj = document.getElementById("EasyPlayerOcx");
var url = document.getElementById("url").value;
var rendertype = document.getElementById("rendertype").checked?1:0;
var rtpovertcp = document.getElementById("rtpovertcp").value;
var cache = document.getElementById("cache").value;
var playsound = document.getElementById("playsound").checked ? 1 : 0;
var showtoscale = document.getElementById("showtoscale").value;
var showsatic = document.getElementById("showsatic").checked ? 1 : 0;
var startNumber = i;
start(url, rendertype, rtpovertcp, cache, showtoscale, playsound, showsatic, startNumber);
}
}
- 想要开始播放,只需要在播放按钮上绑定startplay函数,并传入播放窗口的序号即可
<button class="start" type="button" onclick="startplay(1);">Start</button>
- 暂停播放,只要在stop按钮上绑定stopplay函数,并传入序号即可
function stopplay(i) {
var obj = document.getElementById("obj" + i);
obj.Close();
}
<button class="stop" type="button" onclick="stopplay(1);">Stop</button>
EasyPlayerPro版本下载:
EasyPlayer-RTSP版本下载:
获取更多信息
- 邮件:support@easydarwin.org
- WEB:www.EasyDarwin.org
- QQ交流群:436297092