The JW Player 5 Beta is considered to be pre-release software. The documentation below can (and will) change to reflect ongoing development.
JW Player: Blocking and Locking
Version 5.0 of the JW Player API introduces a set of mechanisms for plugins to block certain player operations.
Blocking
When a plugin blocks the player, all playback halts, and no player operations are allowed (such as load, play, pause, next, see, etc.). This allows a plugin to run sensitive code, such as loading an external configuration file, reconfiguring the playlist or prompting the user for input. While the block is in place, no other plugin or javascript may cause the player to resume playing.
Please note: if a plugin is written in such a way that it blocks the player, but does not release the block, this can result in an unusable player.
Example: Plugin Executing a Block
function initPlugin(player:IPlayer, config:PluginConfig):void {
player.block(this);
/// Run sensitive code here
player.unblock(this);
}
Locking
When the player is locked, the user controls become disabled, and all user input is ignored (although plugins may circumvent this, and should respect the player's lock state).
Example: Plugin Executing a lock
/** Lock/unlock player **/
function toggleBlocking():void {
if (player.locked) {
player.lock(this);
} else {
player.unlock(this);
}
}
