This is a message.

Player events

Here is a list of player events that you can define actions for. These are specified in the configuration root. For example:

flowplayer("player", "flowplayer-3.2.18.swf", {
// player events are defined directly to "root" (not inside a clip)
onLoad: function() {
alert("player loaded");
}
});

JavaScript

Each Player fires events that can inform you of changes in the Player and of actions the Player intends to take or has just taken. The event listener receives as its this variable a reference to the current Player instance.

Before events are marked in italics in the table below. Not all events have a before event. The ‘Cancel action’ column says what will happen when a before event listener returns false.

EventWhen does it fire?Cancel action

onBeforeClick

This event fires: after Flowplayer has been installed on the container, and the container element is not empty (it contains html), and it is clicked.

Flowplayer's load method will save the content of the container and replace it with the Player. The load action will not be invoked if the onBeforeClick listener return false. If you cancel the action, you can later call the load() method to load the Player in the container.

Note: when a new Player is installed, Flowplayer will unload all other Players that were installed on non-empty containers, that is, those Players are removed from the canvas and their containers' original html content is restored, unless their onBeforeUnload event listener returns false.

Flowplayer will not be installed.

onLoad
onBeforeLoad

The load action of Flowplayer follows the successful installation of the Flowplayer Flash component in the container. If the Player was set up with an initial splash image (or any other HTML), this action saves the container's current content and replaces it with the Player.

Before the load action is performed, Flowplayer first fires the onBeforeLoad event, giving you an opportunity to defer loading or change its behavior or splash image. Returning false from an onBeforeLoad event listener will cancel the load action.

The onLoad event fires after the load action has completed. When this event fires, the Player is fully operational and all API methods are available. It will not fire when the onBeforeLoad event listener returned false.

Player will not be loaded.

onUnload
onBeforeUnload

Flowplayer's default unload behavior is to replace the content of the container with the originial content. Before Flowplayer performs this action, it fires the onBeforeUnload event, giving you a chance to cancel unloading. Following the unloading the onUnLoad event fires. These events only fire when the container initially contained html.

After the Player has been unloaded from a container that contains html, clicking the container will (again) fire the onBeforeLoad event.

These events will only fire when the container was not empty.

Player is not unloaded.

onMouseOver

This fires when the mouse pointer moves into the player area.

onMouseOut

This fires when the mouse pointer moves out of the player area.

onKeyPress
onBeforeKeyPress

This fires when a user presses a key on the keyboard while the Player has the focus. The code corresponding to the key which has been pressed is provided as the first argument to the event listener. A list of different key codes is given here.

Default keyboard actions are ignored. (By default, the spacebar toggles between playing and paused states, and the arrow keys seek backward and forward.)

onVolume
onBeforeVolume

This fires when the volume level is changed (via any of the setVolume, mute or unmute methods). The new volume level is provided as the first argument to the event listener.

Volume level is not changed.

onMute
onBeforeMute

This fires when the player is muted.

Volume level is not changed.

onUnmute
onBeforeUnmute

This fires when the player is unmuted.

Player stays muted.

onFullscreen
onBeforeFullscreen

This fires when full screen mode is entered.

Full screen mode will not be entered.

onFullscreenExit

This fires when full screen mode is exited. (Unfortunately, there is currently no 'onBeforeFullscreenExit' event. This is because the current implementation of Flash does not permit this action to be cancelled.)

onClipAdd

Since 3.1.1. This fires when a clip was added to the playlist via the addClip method. The first argument is the newly added Clip object. The second argument is the index number which specifies the position in the playlist. This event is not fired when an instream clip is added.

onPlaylistReplace

This fires when the playlist is swapped out for another. This typically happens when the play(clip) method is called and the original playlist is replaced with a single clip playlist. The new playlist object (an array of Clip objects) is provided as the first argument to the event listener.

onError

This fires when an error occurs inside the player. The event listener receives two arguments: errorCode and errorMessage, as in the following table.

Error Codes

100

Plugin initialization failed

200

Stream not found

201

Unable to load stream or clip file

202

Provider specified in clip is not loaded

300

Player initialization failed

301

Unable to load plugin

302

Error when invoking plugin external method

303

Failed to load resource such as stylesheet or background image