This page provides a reference of the Flash plugin API, intended for ActionScript plugin developers.
At large, JavaScript and Flash plugins have the same structure and features. Two overall areas in which Flash differs are event listening and class definitions.
A big general difference between JavaScript and Flash is that the latter uses a formal event dispatcher model to send out events. Listening to an event generally works like this:
private function volumeListener(event:MediaEvent) { var newVolume:Number = event.volume; } player.addEventListener(MediaEvent.JWPLAYER_MEDIA_VOLUME, volumeListener);
JW6 defines four types of events:
The Mapping section below includes the event type for all API calls.
Since ActionScript is a strongly typed language, plugins must import all JW6 classes they use. Here is a list of all packages plugins can import and the classes they contain:
For compiling, this JW6 plugin SDK includes the jwplayer6.swc library, containing all class definitions. See Building Flash Plugins for more info.
Flash plugins leverage the same API calls as JavaScript plugins or standalone scripts. Due to ActionScript/JavaScript differences and backward compatibility concerns, the APIs do not 100% translate though. Therefore, this section lists all JW6 API calls, mapping how they differ between JavaScript and Flash.
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getRenderingMode | - | The mode is always flash in Flash ;) |
onReady | PlayerEvent.JWPLAYER_READY | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getPlaylist | playlist | This is a getter that returns the playlist |
getPlaylistItem | playlist.currentItem playlist.getItemAt | Separate calls upon the playlist object. |
load | load | - |
playlistItem | playlistIndex | - |
onPlaylist | PlaylistEvent.JWPLAYER_PLAYLIST_LOADED | - |
onPlaylistItem | PlaylistEvent.JWPLAYER_PLAYLIST_ITEM | - |
onComplete | MediaEvent.JWPLAYER_MEDIA_COMPLETE | - |
onPlaylistComplete | PlaylistEvent.JWPLAYER_PLAYLIST_COMPLETE | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getBuffer | - | Only available through the event |
onBufferChange | MediaEvent.JWPLAYER_MEDIA_BUFFER | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getState | config.state | This is a getter on the player config |
play | play | - |
pause | pause | - |
stop | stop | - |
onBeforePlay | MediaEvent.JWPLAYER_MEDIA_BEFOREPLAY | - |
onPlay | PlayerStateEvent.JWPLAYER_PLAYER_STATE | There's a newstate event property |
onPause | PlayerStateEvent.JWPLAYER_PLAYER_STATE | There's a newstate event property |
onBuffer | PlayerStateEvent.JWPLAYER_PLAYER_STATE | There's a newstate event property |
onIdle | PlayerStateEvent.JWPLAYER_PLAYER_STATE | There's a newstate event property |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getPosition | - | Only available through the event |
getDuration | - | Only available through the event |
seek | seek | - |
onSeek | MediaEvent.JWPLAYER_MEDIA_SEEK | - |
onTime | MediaEvent.JWPLAYER_MEDIA_TIME | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getMute | config.mute | This is a getter on the player config |
getVolume | config.volume | This is a getter on the player config |
mute | mute | - |
volume | volume | - |
onMute | MediaEvent.JWPLAYER_MEDIA_MUTE | - |
onVolume | MediaEvent.JWPLAYER_MEDIA_VOLUME | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getWidth | config.width | This is a getter on the player config |
getHeight | config.height | This is a getter on the player config |
getFullscreen | config.fullscreen | - |
resize | - | plugins cannot resize player |
onFullscreen | - | plugins have an inline resize() |
onResize | - | plugins have an inline resize() |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getQualityLevels | getQualityLevels | - |
getCurrentQuality | getCurrentQuality | - |
setCurrentQuality | setCurrentQuality | - |
onQualityLevels | MediaEvent.JWPLAYER_MEDIA_LEVELS | - |
onQualityChange | MediaEvent.JWPLAYER_MEDIA_LEVEL_CHANGED | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
addButton | controls.dock.addButton | This is for compatibility purposes |
removeButton | controls.dock.removeButton | This is for compatibility purposes |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
getControls | getControls | - |
getSafeRegion | getSafeRegion | - |
setControls | setControls | - |
onControls | ViewEvent.JWPLAYER_CONTROLS | - |
onDisplayClick | ViewEvent.JWPLAYER_VIEW_CLICK | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
onError | MediaEvent.JWPLAYER_MEDIA_ERROR | - |
See the JavaScript API Reference for details on these API calls.
JavaScript | Flash | Comments |
---|---|---|
onMeta | MediaEvent.JWPLAYER_MEDIA_META | - |