Event bubbling
standalone demo
When an event occurs the playlist listener is called first and after that the common clip listener is called. This is called "event bubbling" - a term that is mostly used in HTML/DOM programming.
NOTE: the demo will trigger JavaScript alert boxes which may be annoying
but are most suitable for demonstrating event bubbling.
This demo is a bit advanced but you should respect this if you are extending Flowplayer functionality with scripting.
Configuration
You can see an onStart listener bind both to the common clip and to a
playlist entry. You can cancel the bubbling so that the common clip event is
not called by returning false from the playlist event listener. This kind of
design pattern is also used in DOM programming.
$f("player", "http://releases.flowplayer.org/swf/flowplayer-3.2.11.swf", {
// listeners defined in the common clip will be invoked
// for all clips in the playlist
clip: {
onStart: function() {
$(".palert").append("<p>common clip event</p>");
}
},
// playlist events are invoked first
playlist: [{
onStart: function() {
$(".palert").append("<p>clip specific event</p>");
// if we would return false here then common clip's onStart
// would not be called
return true;
}
}]
});
