Amalia.js embeds API for control the player using JavaScript. Below you will find details of events and api functions.
The sample HTML page below creates an embedded player that will load a video with button outside player to playback video.playback.
<html> <head> <!-- 0. Add dependences --> <script type="text/javascript" src="bower_components/jquery/dist/jquery.js"></script> <script type="text/javascript" src="bower_components/jquery-ui/jquery-ui.min.js"></script> <script type="text/javascript" src="bower_components/raphael/raphael.js"></script> <link href="build/css/amalia.js.min.css" type="text/css" rel="stylesheet"/> <script src="build/js/amalia.js.min.js" type="text/javascript"></script> </head> <body> <!-- 1. The <div> tag will contains the player. --> <div id="player"></div> <button onclick="playVideo()">Play</button> <script> var player = null; // 2. Function to execute when the DOM is fully loaded $(document).ready(function () { // 3. Init player with default parameters $("#player").mediaPlayer({ src: "samples-data/examples/vid/amalia01.mp4", callbacks: { onReady: 'onReady' } }); }); // 4. The API will call this function when the video player is ready. function onReady() { player = $('#player').data('fr.ina.amalia.player').getPlayer(); // Set event listener on time change. $('#player').on('fr.ina.amalia.player.PlayerEventType.TIME_CHANGE', onTimeChange); } // 5. Function will call on click to button play function playVideo() { if (player !== null) { player.play(); } } // 6. Function will call on time change event function onTimeChange(event, data) { } </script> </body> </html>
Event Name | Description | Data |
---|---|---|
fr.ina.amalia.player.PlayerEventType.INIT | When the player has initialized | |
fr.ina.amalia.player.PlayerEventType.STARTED | Fired when the player has started with duration | |
fr.ina.amalia.player.PlayerEventType.PLAYING | Fires when playing event. | |
fr.ina.amalia.player.PlayerEventType.PAUSED | Fires the paused/resumed | |
fr.ina.amalia.player.PlayerEventType.ENDED | Ended event should fire when a video is completely. | |
fr.ina.amalia.player.PlayerEventType.MUTE | Fired when the player has gone into mutes. | |
fr.ina.amalia.player.PlayerEventType.UN_MUTE | Fired when the player has gone into unmutes. | |
fr.ina.amalia.player.PlayerEventType.VOLUME_CHANGE | Fired when the player volume was changed |
|
fr.ina.amalia.player.PlayerEventType.TIME_CHANGE | This event is fired as the playback position gets updated. |
|
fr.ina.amalia.player.PlayerEventType.FULLSCREEN_CHANGE | This fires when full-screen mode change |
|
fr.ina.amalia.player.PlayerEventType.SEEK | Fired when the seeks. |
|
fr.ina.amalia.player.PlayerEventType.ERROR | Fired when a media error has occurred. | |
fr.ina.amalia.player.PlayerEventType.PLUGIN_READY | Fired when the plugin has initialized. | |
fr.ina.amalia.player.PlayerEventType.PLUGIN_ERROR | Fired when a plugin error has occurred. | |
fr.ina.amalia.player.PlayerEventType.DATA_CHANGE | Fired when data change |
|
fr.ina.amalia.player.PlayerEventType.BEGIN_DATA_CHANGE | Fired when data change | |
fr.ina.amalia.player.PlayerEventType.END_DATA_CHANGE | fired at the beginning of data change | |
fr.ina.amalia.player.PlayerEventType.IMAGE_CAPTURE | Fired end of data change |
|
fr.ina.amalia.player.PlayerEventType.ZOOM_RANGE_CHANGE | Fired end of data change |
|
fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE | Fired on zoom range change |
|
fr.ina.amalia.player.PlayerEventType.SELECTED_ITEMS_CHANGE | Fired on select item |
|
fr.ina.amalia.player.PlayerEventType.PLAYBACK_RATE_CHANGE | Fired on playback rate change item |
|
fr.ina.amalia.player.PlayerEventType.START_SEEKING | Fired when start seeking. |
|
fr.ina.amalia.player.PlayerEventType.STOP_SEEKING | Fired when stop seeking. |
|
fr.ina.amalia.player.PlayerEventType.STOP_SEEKING | Fired when seeking. |
|
Name | Description | Parameters |
---|---|---|
play() | Plays the currently video. | |
pause() | Pauses the currently playing video. | |
isPaused() | Returns true if the player is paused. | |
stop() | Stops and cancels loading of the current video. | |
seek(time) | Seek |
|
mute() | Mutes the player. | |
unmute() | Unmutes the player. | |
isMute() | Returns true if the player is muted. | |
getTcOffset() | Returns time offset. | |
getDuration() | Returns the video duration. | |
getVolume() | Returns the player's current volume, an integer between 0 and 100. | |
setVolume(value) | Sets the volume. |
|
rangePlay(tcin, tcout, autoplay) | Playback ths specified time range. |
|
getCurrentTime() | Returns the current position with tcOffset. | |
setCurrentTime(value) | Set the specified position | |
getPlaybackrate() | This function retrieves the playback rate of the currently playing video. | |
setPlaybackrate(value) | This function sets the suggested playback rate for the current video. | |
upPlaybackrate() | Up the playback rate | |
downPlaybackrate() | Down the playback rate | |
getFullscreen() | Returns the current fullscreen state (true or false). | |
toggleFullScreen() | Toogle the fullscreen state (true or false). | |
getCurrentImage() | Return the current image of the video. | |
getTcImage() | Return the specified position image of the video. | |
moveNextFrame() | Move the next frame of the video. | |
movePrevFrame() | Move the prev frame of the video. | |
addMenuItemWithLink(title, link, className) | To Add the context menu item. | |
getBlockMetadata(id) | Return the block of metadata. |
|
getBlocksMetadata() | Return all block of metadata. | |
updateBlockMetadata(id, data, action) | Update the block metadata with the specified data. |
|
removeBlockMetadata(id) | Remove the block metadata with specified id. |
|
addAllMetadata(parsedData) | Add metadata |
|
addMetadataById(id, parsedData) | Return the metadata for the specified id. |
|
replaceAllMetadataById(id, parsedData) | Replace metadata for the specified id. |
|
deleteAllMetadataById(id) | Delete the specified metadata. |
|
getMetadataById(id) | Return metadata for the specified id |
|
setMetadataById(id, data) | Set metadata by id | |
removeMetadataById(id) | Remove metadata for the specified id | |
getMetadataWithRange(id, tcin, tcout) | Return a metadata by specified time code. |
|
getSelectedMetadataId() | Return selected metadata id. |
|
setSelectedMetadataId(id) | Set selected metadata id |
|
addMetadataItem(metadataId, data) | Add metadata item | |
getSelectedItems() | Return selected items | |
addSelectedItem(item) | Add selected item | |
removeAllSelectedItems() | Remove all selected items | |
getTcin() | Return tcin with tc offset | |
getTcout() | Return Tcout with tcoffset and media duration | |
setZoomTc(zTcin, zTcout, eventTag) | In charge to set zoom tc |
|