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的每個實例,如果它存在在網頁上?謝謝。