Flowplayer Configuration Tailor every aspect of the player to your needs
Player configuration
A Player is installed on a webpage by a call to the flowplayer() function or its shorthand $f(). See installation on how and where to place this call and see the documentation of the flowplayer() function in the api, Player creation.
Player is the top-level object. Configuration properties and event listeners are placed in the root of the configuration; it is not a sub-object of the configuration. Example:
flowplayer("player", "/path/to/flowplayer-3.2.4.swf", {
buffering : false, // set a Player property
onLoad : function() { // provide a Player event listener
this.unmute();
}
}
);
This section describes the two configuration parameters of the flowplayer() function:
flowplayer("player", Flash configuration, Player configuration);
Player Configuration (3rd parameter)
You can set Player properties and can supply event listeners for a Player in the configuration.
Player properties
| property / type | default | description | ||||
|---|---|---|---|---|---|---|
| buffering boolean |
true | Specifies whether the rotating buffering animation must be shown or not. Set this to false and the animation will not be shown. | ||||
| debug boolean |
false | Configures logging of the Flowplayer JavaScript component. This will output all events triggered by the Flash component to the Firebug or Safari Dev tools console. | ||||
| log object |
- |
Configures logging of the Flash component to the Firebug or Safari Dev tools console. This configuration object has the following properties you can set:
Example:
|
||||
| streamCallbacks list |
- | Names of NetStream callback functions to be registered to the player. This allows a way to listen to custom events that can be triggered by the streaming server or a custom application running in the streaming server. | ||||
| connectionCallbacks list |
- | Names of NetStream callback functions to be registered to the player. This allows a way to listen to custom events that can be triggered by the streaming server or a custom application running in the streaming server. |
Player events
You can supply listeners for Player events in the configuration. These are placed in the root of the configuration. See also events in the JavaScript api.
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 gray. Not all events have a before event. The 'Cancel action' column says what will happen when a before event listener returns false.
| Event | When 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 action 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 setup 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 when 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 addClip method. First argument is the newly added Clip object and second argument is the index number that 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 follows:
|
|||||||||||||||||
Flash configuration (2nd parameter)
The second parameter of the flowplayer() function specifies the Flash embedding parameters. If you supply it as a simple string it is treated as the src property of flashembed which defines the path to the Flowplayer Flash component (.swf). If you want to customize the Flash embedding, you can supply the settings as an object written in json.
Flowplayer uses our flashembed tool to embed the Flowplayer Flash component on the page. This tool is included in the flowplayer-3.2.4.js file and you have all its power available such as version detection and handling of old Flash versions. All Flash configuration options are given directly to flashembed.
See also:
- Flash embedding in the introduction
- Full list of Flashembed configuration properties
- All standard Flash parameters
- Demo: Flashembed
- Demo: placing HTML content over the video using wmode configuration property
Flowplayer uses the following defaults:
| property | description |
|---|---|
| version |
The required Flash version for Flowplayer is [9, 0] and this is supplied as the default value. You can use a greater value such as [9, 115] if you require support for the MP4 format.
When a Flash version lower than 9.0 is encountered, Flowplayer attempts to use Express Install and if the user has a version lower than 6.56 or no Flash at all, then Flowplayer shows the default error message as specified in this flashembed demo (2. Default content in the container). |
| expressInstall | By default, Flowplayer uses this file: http://flowplayer.org/swf/expressinstall.swf for those users that have less than version [9, 0] but greater than [6, 56]. You can skip Express Install by setting expressInstall to null. |
In the following example we supply a custom onFail listener for Flash versions that do not support MP4. On Flash versions below 9.115, users will experience an Express Install and additionally our onFail event listener is called, explaining the problem in an info box. The same behaviour occurs if the container is configured with an initial splash image.
Here is the JavaScript and html code for this example:
<!-- setup player container -->
<div id="player" style="width:425px;height:300px"></div>
<div id="info" class="box info">
You have Flash version 9.115 or above. Enjoy high quality video!
</div>
<script>
// Flowplayer installation with Flashembed configuration
flowplayer("player", {
// our Flash component
src: "http://releases.flowplayer.org/swf/flowplayer-3.2.4.swf",
// we need at least this Flash version
version: [9, 115],
// older versions will see a custom message
onFail: function() {
document.getElementById("info").innerHTML =
"You need the latest Flash version to see MP4 movies. " +
"Your version is " + this.getVersion()
;
}
// here is our third argument which is the Flowplayer configuration
}, {
clip: "KimAronson-TwentySeconds6421.m4v"
});
</script>