The documentation as listed below applies to Projekktor V0.7.17 or higher.
projekktor is the central function to create or select player instances.
To instantiate a player use identifier to provide information which element(s) you want the player to sit on. identifier is identical to jQuery selectors.
E.g: projekktor('#player_one'); will apply to a media-tag with the id attribute player_one, projekktor('video')); will projekktorize all video elements on page and so on. Optionally you can provide a config object like this: projekktor('#player_one',{enableFlashFallback:false});
The “onReady” function will be triggered once the player has been initialized. The function gets the player Object as argument.
To get an instance previously set up as described above you can simply use projekktor(); again. This time identifier is a jQuery object or the id of the player you want to fetch. E.g: projekktor('player_a').setStop(); or projekktor($('#player_a')).setStop();
To get all available instances, use “*” as identifier. In return you will get an array of Projekktor instances.
Adds a function as callback listener for the event specified. Can be applied at any time.
Removes a previously added function from event listening. callback must be the same entity as used in corresponding addListener call. E.g:
WIN:
var ApiTest = function(data) {console.log(data)};
playerInstance.addListener('*',ApiTest );
playerInstance.removeListener('*',ApiTest );
FAIL:
playerInstance.addListener('*',function(data) {console.log(data)});
playerInstance.removeListener('*',function(data) {console.log(data)});
Returns TRUE on success otherwise FALSE.
Applies a single media item or a playlist. This will overwrite all current media and playlist data scheduled within in the player.
Sets, adds, removes or replaces a playlist item.
Data can be an object following the projekktor item scheme, an URL string pointing to a valid media file or NULL. If data is NULL the item at index will be removed from schedule (remove). If data is an Object and or an URL and index is NULL a new item will be injected to schedule (add). index indicates the schedule index to be affected.
If index is out of range (less 1 or higher than the total length of the current schedule) a new item will be appended to the schedule otherwise a new item will be created on position provided.
If replace is true and an item already exists at index the new item will not be injected but will replace the already existing one - if any.
If calling this function affects the item currently playing back, the player will instantly stop and restart playback with the new data made available and without changing the “currentItem” pointer.
If setItem affects items after the currently playing one (items of an higher index than currentItem) no restart apply.
If index is out of range (less 1 or higher than the total length of the current schedule) the last scheduled item will be removed. Otherwise the item at the index provided gets dumped.
replace has no effect while performing remove actions.
If calling this function affects the item currently playing back, the player will instantly stop and will move the currentItem pointer to the previous one.
If setItem affects an item after the currently playing one (items of an higher index than currentItem) no previous-action will happen.
Was “setItemConfig” prior V0.9.0.
Allows to set or alter item config options during runtime. data must be an object containing one or more config parameters. Not all config options are available to be set dynamically to avoid the player to crash or react in a strange way (please refer: Configuration parameters).
destIndex can either be an integer describing the destination item´s position within schedule (itemIdx) or '*' which will apply data to all items currently scheduled. If destIndex is NULL the currently played item is manipulated.
Sets the poster for the player. This poster is shown up once the player has been instantiated, autoplay is FALSE and the user did not hit play so far.
This method is a shortcut for setItemConfig({poster:url},0);
Move the play-head to the given position.
Position can be either in seconds (number) representing the absolute second to move the playhead to or a relative value prefixed with operators ”+” or ”-” indicating the direction to move the playhead to.
E.g. assumed the playhead is on second #15, ”+5” will move it to second #20 while ”-5” will move it to #10.
If the resulting position is beyond the point of loaded media data so far and the current media type does not allow random-seeking, the play-head will be moved to the highest possible position. This function has no result. You have to listen to player events in order to check what happens. Nothing will happen at all if player´s config-option “disallowSkip” is set to TRUE.
Sets the Volume of the player to a percent mark indicated by vol.
Volume can be either a numeric value representing the absolute volume to set, where 0 is equal to muted and 100 indicates full throttle. Volume can also be relative - prefixed with operators ”+” or ”-” indicating the relative amount to adjust the volume to. E.g. assumed current volume is 15%, ”+5” set it to 20%, ”-5” to 10% and so on. This function has no result. You have to listen to player events in order to check what happens. Nothing will happen at all if player´s config-option “fixedVolume” is set to TRUE.
Sets the player to fullscreen / full viewport or exits from there depending if goFullscreen set to TRUE (on) or FALSE (off). Does nothing if ALLOWFULLSCREEN is FALSE or if the new state is equal to the current one.
Triggers the internal “resize” event in order to rescale relative containers. This comes in handy in cases where DOM manipulations happen due to other scripts (e.g. sliders, popups etc.)
Allows to set the player´s dimensions during runtime. Will also trigger “resize” in order to apply rescaling (if required).
Sets the player to pause if its playing or vis versa.
Sets the player to play. If its already playing no changes apply.
Sets the player to pause . If its already paused no changes apply.
Sets the player to stop . Will cause the playback component to stop immediately and displays the current item´s poster image. Furthermore the start-button shows up.
Initializes playback of media item identified by the given item. Accepts an integer representing the item to be played or a “shortcut” string as follows:
Shortcuts:
If the player has been previously awakened by user-interaction or by AUTOPLAY set to TRUE, the new active item will be played back immediately.
Adds a cue point to an active player instance.
Instantly removes a cuepoint from the player instance. You must specify a “group” and the “idx” of the affected video item. In order to identify the addressed cuepoints by “group” the cuepoint´s “group” property must be priorly set accordingly.
In case you added one or more cue-points via .setCuePoint() you must let the player know about that. Guess how.
Overwrites the quality setting applied through the config option “playbackQuality”. Will force the player to instantly switch to the requested quality type. Possibe quality values are: 'small', 'medium', 'large', 'hd720', 'hd1080'.
If parameter is invalid or the requested quality isn´t available nothing will happen. Otherwise the player will trigger the “qualityChange”-event.
Instantly destroys the referred instance and reconstructs its host DOM´s original state; the one before the player has been applied.
Resets the instance while keeping current configuration and schedule intact. Sets the active item pointer back to zero.
Opens an URL depending on “target” either in the same or in a new window, optionally pauses the player.
Returns the amount of media items within the playlist.
Returns the sound volume of the player instance where 0 is muted and 1 is full throttle.
Returns the internal playlist index of the currently played item. Note that 0 is for the first item in line.
Returns the unqiue ID of the currently played item if any.
experimental
Returns one or more items identified by idx. idx can either be a numeric value describing the internal playlist position of the requested item or one of the following shortcuts:
Not setting “idx” will return the currently played item so you don´t have to use 'getItemIdx()' beforehand.
The resulting array holds 0..n objects of “processed” playlist data. Each object has the following properties:
Returns how many percent of the currently played item has been loaded/buffered so far. Will instantly be 100 on media types available for random-seeking.
Returns the current playhead position in percent relative to the currently played item´s duration.
soon
Returns the current playhead position in milliseconds.
Returns the duration of the currently played item in milliseconds.
Retruns the difference between currently played item´s duration and the playhead position in milliseconds.
Experimental
Experimental
Experimental Moved to “Splash” plugin
Returns TRUE if the player is in fullscreen / full viewport mode, otherwise FALSE.
Returns the player´s current unique DOM ID.
Returns of what type the currently played item is. (LIST GOES HERE)
Returns true if the current item uses the Flash fallback component for playback.
Returns TRUE if the client browser is able to play back the provided type in general - regardless if html5-video, Flash or any other plugin will be used to do so.
You can fine-tune the testing by setting platform to any value described here.
Used without parameter this method returns TRUE if the client browser is able to play back at least one media type natively. If type parameter is set the test is performed for the specific media type and will return TRUE if it can be played back natively.
If the player is in “iframe mode” this function returns the iframe´s parent window for further manipulations.
If the player is in “iframe mode” this function returns the iframe the player lives in.
Returns the whole currently scheduled playlist. Same as getItem('*').
If called without argument this method returns the current state of the player. You can find a list of possible states here. If “test” is not NULL and a valid state string the method will return TRUE or FALSE according to current playerstate (e.g.: getState('PLAYING') will return TRUE if the player is playing).