function flashEvent(e){
alert('ID: '+e.flashObjectID+', isAD: '+e.isADPlaying+', playingVideoNum: '+e.playingVideoNum+', Event: '+e.event);
}
The function receive the object "e" that consists of following fields:
| e.flashObjectID | The ID of flash object on the page. (the value can be helpful if you have several players) |
| e.isADPlaying | Returns "true" if playing video is advertisement. |
| e.playingVideoNum | The number of playing video in playlist. |
| e.event | Returns current event name: - "Play" - video is started automatically or by click on "Play" button, - "Pause" - video is paused, - "Stop" - video is stopped by "Stop" button, - "videoCompleted" - video is finished, - "playerIsReady" - player is loaded and ready to get Javascript commands |
function flashEvent(e){
if(e.event=="videoCompleted" && e.playingVideoNum=="3"){
myCustomFunctionCall();
}
}
2) For example you want to pass new video URL in the player, as soon as the page is loaded.
function flashEvent(e){
if(e.event=="playerIsReady"){
var player = swfobject.getObjectById(e.flashObjectID);
player.JS_PlayVideo('customURLvideo.flv')
}
}
3) The following example shows how to shuffle or make a random playback of playlist.
function flashEvent(e){
if(e.isADPlaying == false){
if(e.event == "videoCompleted") {
playRandom(e.flashObjectID);
}
}
}
function playRandom(id){
var player = swfobject.getObjectById(id);
player.JS_PlayRandom();
}