1
我使用的是html5media库,该库使用Flowplayer Flash Player为不支持视频标签的浏览器自动替换页面上的HTML5视频标签。这发生在IE和一些较旧的浏览器上。检测页面上的Flowplayer并添加事件监听器
我需要检测页面上是否存在Flowplayer,并向用户开始播放视频时触发JavaScript函数的每个实例添加事件侦听器。这可能通过jQuery? Flowplayer的Player对象的API描述为here;一些例子:
/* Set common clip properties and event listeners
* in run-time
*/
// register event listener with common clip
$f("player").onStart(function() {
alert("Playing");
});
// this does the same thing
$f("player").getCommonClip().onStart(function() {
alert("Playing");
});
// if you want to register a listener to a specific clip *only*
$f("player").getClip(1).onStart(function() {
alert("Playing");
});
你如何附加一个事件侦听器在onStart事件到的Flowplayer的每个实例,如果它存在在网页上?谢谢。