getTrackDataset

 

Returns an object containing keys for artist, title, album, url,  image (coverart), and anything else available in the palylist item. See Track Dataset for more info on what is available in the object.

When no index argument is provided, the currently playing track's info is returned.

Use the index argument to get a specific item in the playlist.

getTrackDataset( index )

 

Parameters

index number (optional)

The zero-based index of the playlist item to retrieve. (e.g. sending "2" will retrieve the 3rd item down (visually) in the playlist because "0" is the first item).

 

Return Value

object

An object containing fields representing.

If the index argument is NOT provided, the current track's info is returned.

Returns the current playing tracks info including title, artist, file and anything else provided to the player through the original playlist.

NOTE: Some additional info is passed back as well that wimpy creates for each track including:
- index: a zero-based number representing the index for the playlist item.
- amPlaylist: a boolean value indicating if the item is a playlist or a media file.

 

 

See Also

 

Examples

<div id="player1" data-wimpyplayer data-media="song1.mp3|song2.mp3|song3.mp3"><div>

<script>
wimpy.onReady(function(){

	var myPlayer = wimpy.getPlayer("player1");
	
	myPlayer.play();

	// Notice the "index" argument is not included. 
// Therefore the currently playing track's info will // be returned to the "info" variable. var info = myPlayer.getTrackDataset(); var output = ""; For(var prop in info){ var str = prop + " " + info[prop] console.log(str); output += str + "\n"; } alert(output); // Here the "index" argument (2) is included, so we're // asking wimpy for a specific playlist item. var info = myPlayer.getTrackDataset(2); var output = ""; For(var prop in info){ var str = prop + " " + info[prop] console.log(str); output += str + "\n"; } alert(output); }); </script>