Wimpy JavaScript Controls - Function ReferenceBy Mike Gieson This page contains a description of available JavaScript controls fundtions for Wimpy Rave. Contents:- List of available Javascript control funcitons List of available Javascript control funcitons:
|
|
Renders a player on your page based on the options established within the rave.js file. The rave.js file contains more information about the available options in the javaScript comments. To render a player: <script language="JavaScript" > To render a player with one file: <script language="JavaScript" > To render a player with a few files, separate each file with a "pipe" character, see Example 2. To render a player with a few files, with each file having additional information:, see Example 3.
|
||||||||||||||||||||||||||
Starts the player or plays the track that is currently selected in the playlist. <a href="javascript:;"onClick="wimpy_play();"> Play </a>
|
|||||||||||||||||||||||||||
Stops the currently loaded track <a href="javascript:;"onClick="wimpy_stop();"> Stop </a>
|
|||||||||||||||||||||||||||
Pauses the currently loaded <a href="javascript:;"onClick="wimpy_pause();"> Pause </a>
|
|||||||||||||||||||||||||||
Goes to a specific track listed in the playlist. The only way to determine which track to "go to" is by referencing a number. Example wimpy_gotoTrack(3) would play the third item in the current playlist. <a href="javascript:;"onClick="wimpy_gotoTrack(2);"> <-- Specify the track number inside the (). Stop </a>
|
|||||||||||||||||||||||||||
Plays the next track in the playlist <a href="javascript:;"onClick="wimpy_next();"> Next </a>
|
|||||||||||||||||||||||||||
Rewinds the play head to the beginning of the track, or goes to the previous item in the playlist depending on the current status of the player's play head. <a href="javascript:;"onClick="wimpy_prev();"> Previous </a>
|
|||||||||||||||||||||||||||
Clears the playlist <a href="javascript:;"onClick="wimpy_clearPlaylist();"> Clear Playlist </a>
|
|||||||||||||||||||||||||||
Returns: nothing |
Adds tracks to the player's playlist. Loads XML data into the player. To add an MP3 file to the playlist <script language='javascript'>
|
||||||||||||||||||||||||||
Returns: Object |
Returns all the information for a track as an Object. If no argument is passed in, the info for the track that is currently playing will be returned. In your HTML: <a href="javascript:;" Wimpy returns: anObject.artist = "The tracks artist"; To retrieve information on a specific item in the playlist , enter the a number as an argument. The number that you enter should correspond to the playlist item. For example, entering "3" as the argument will get the info for the third item in the playlist. wimpy_getTrackInfo(3) In the example above, all the information for the third item in the playlist will be returned. NOTE: If the playlist is being sorted, the item may be different than the order in which the source XML playlist. If the player has not yet started to play a track, the info for the first item in the playlist is returned. If the player does not have anything in the playlist Wimpy will return false (boolean). See also:
|
||||||||||||||||||||||||||
Returns: nothing |
Loads a playlist file into the player. Example: <a href="javascript:;"onClick="wimpy_loadExternalPlaylist("http://path/to/playlist.xml");"> Load a playlist. </a>
|
||||||||||||||||||||||||||
Returns: Boolean
|
This function will get pinged when Wimpy is ready and able to accept JavaScript calls / interaction. Wimpy will call this function as needed to inform you of the event. In order for this function to be enabled, the variable "enableWimpyEvents" to be set to true. Open rave.js in a text editor and scroll down to the "Advanced Usage" area. Example: var enableWimpyEvents = true; See also wimpy_amReady_ask()
|
||||||||||||||||||||||||||
Returns: Object |
This function gets pinged every time a track starts to play. Wimpy will call this function as needed to inform you of the event. In order for this function to be enabled, the variable "enableWimpyEvents" to be set to true. Open rave.js in a text editor and scroll down to the "Advanced Usage" area. Example: var enableWimpyEvents = true; Wimpy will return an Object that contains all of the track information. See also:
|
||||||||||||||||||||||||||
Returns: Object |
// This function gets pinged each time a track finishes playing. Wimpy will call this function as needed to inform you of the event. In order for this function to be enabled, the variable "enableWimpyEvents" to be set to true. Open rave.js in a text editor and scroll down to the "Advanced Usage" area. Example: var enableWimpyEvents = true; Wimpy will return an Object that contains all of the track information. See also:
|
||||||||||||||||||||||||||
Returns: Boolean
|
Checks to see if Wimpy has been initialized and is ready to accept JavaScript calls / interaction. Example: <a href="javascript:;"
|
||||||||||||||||||||||||||
Returns: nothing |
Set the player's volume Example: <a href="javascript:;"
|
||||||||||||||||||||||||||
Returns: nothing
|
Sets the "loop track" button to the specified state. State options are: Example: <a href="javascript:;"onClick="wimpy_setLoopTrackState('on')"> on </a>
|
||||||||||||||||||||||||||
Returns: nothing |
Sets the "random playback " button to the specified state. State options are: Example: <a href="javascript:;"onClick="wimpy_setRandomState('on')"> on </a>
|
||||||||||||||||||||||||||
Returns: nothing |
Sets the "repeat track " button to the specified state. State options are: Example: <a href="javascript:;"onClick="wimpy_setRepeatState('on')"> on </a>
|
||||||||||||||||||||||||||
Returns: nothing |
Sets the "loop track" button to the specified state. State options are: Example: <a href="javascript:;"onClick="wimpy_setLoopTrackState('on')"> on </a>
|
||||||||||||||||||||||||||
Returns: nothing
|
Puts new information into the scroll info display area. Accepts two arguments, the first refers to the Artist, the second the Title of the track. This option is useful when running Icecast streams and allows you update the scrolling display dynamically. Example: <a href="javascript:;"onClick='wimpy_updateInfoDisplay("My New Artist", "My New Title")'> Update Artist and Title </a>
|
||||||||||||||||||||||||||
Returns: Number
|
Gets the current playhead percentage.
|
||||||||||||||||||||||||||
Returns: nothing |
Sets the playhead to the specified percentage. NOTE: This option was not designed to for use milliseconds after launching a file. In other words, some folks might be trying to use this function to "pick up" playing where a user left off last time they visited a page. Although this kind of functionality can be achieved, it will require additional scripting to accomplish because the file must have enough data loaded before Wimpy can advance the playhead. For example, lets say you launch a track, then immediately call this function and set the argument to 95 (meaning "set the playhead so that the track starts playing at 95%"... Since it is highly likely that the file has not been fully loaded milliseconds after launching it, Wimpy will not advance the playhead to 95%. Wimpy can only advance the playhead to a percentage that has been loaded. This means that you will probably need to use the wimpy_getLoadPercent function before calling this "set" function in order to determine how much of the file has been loaded, and / or if it is safe to advance the playhead. Here's a potential method for achieving this kind of functionality: // Create a player:
|
||||||||||||||||||||||||||
Returns: Number
|
Gets the playhead position in seconds. |
||||||||||||||||||||||||||
Returns: nothing
|
Sets the playhead to the specified second. See "NOTE" in wimpy_setPlayheadPercent(); . |
||||||||||||||||||||||||||
Returns: Number
|
Retrieves the loading status according to percent loaded (0-100). |
||||||||||||||||||||||||||
Returns: Object
|
Retrieves all information associated with file loading. The object will contain the following variables:
See also:
|
||||||||||||||||||||||||||
Returns: Object |
Retrieves all information associated with clip playback. The object will contain the following variables:
See also:
|
||||||||||||||||||||||||||
Returns: Number
|
Returns the total number of tracks loaded into the playlist. |
||||||||||||||||||||||||||
Returns all the information for a specific track loaded into the Wimpy playlist. Wimpy returns the information as an array, where the first index of the array is a string identifying the name of the function (e.g. "wimpy_returnPlaylistItem " which allows you to distinguish between different function calls returned to the function that is defined in js_wimpy_returnOnComplete. This function requires js_wimpy_returnOnComplete to be established within rave.js. See the comments within rave.js for how to use this feature. <a href="javascript:;" See readme_wimpy_mp3_js_example6.html for example of how to use this feature. See also:
|
|||||||||||||||||||||||||||
Returns: XML
|
Returns the current playlist as a string in the form of XML data.
|
||||||||||||||||||||||||||
Returns: Array
|
Returns an array where each item in the array is an object. that refers to a playlist item. Example: returned_array[0] = playlist_item_object
Each "playlist_item_object" can be interpreted using the method described in "Reading a Returned Object." This method is provided so that you don't have to convert the XML into a usable array or object. It should be noted that in each playlist_item_object, the <item> XML is also included in the XMLdata variable.
See also:
|
||||||||||||||||||||||||||
Allows you to call a custom plugin. wimpy_callPlugin(pluginID, argument)
Where pluginID refers to the ID name given to the plugin. The ID can be modified using Skin Machine. Only one argument is allowed to be sent it. If your plugin requires more than one argument to be sent in, the argument must be formatted according to the method described by the plugin author. Usually this means "packaging" the multiple arguments with some kind of delimiter, such as a pip " | " or carat " ^ ". Example: var myPluginID = "CoolPlugin";
|