Playlist Interaction

 

You can hijack the "link" or "download" playlist icon buttons to provide customized playlist interaction.

To do so:

1. Use the glyphLink or glyphDownload player options to assign a custom icon.

2. Use the setLinkHandler or setDownloadHandler to provide a function to deal with user clicks.

Example

Here we will hijack the "link" button and replace it's functionality so when clicked, the playlist item will get deleted.

 

<script>

// A custom function to handle user clicks.
function myLinkHandler(returnedItemData){
	
	// Pop up a confirmation dialog.
	var answer = confirm ("Are you sure you want to delete this playlist item?");
	
	// Only delete if the user is sure.
	if (answer){
		player.removePlaylistItems("i", returnedItemData.i);
	}
	
}

// Create a new player
var player = new wimpyPlayer({
		media : "song1.mp3|song2.mp3|song3.mp3",
		linkEnable : 1, // Turns the link icon on all the time.
		glyphLink : "x" // Assigning a custom icon to the link icon.
	});


// Setting the "setLinkHandler" to the "myLinkHandler" function above.
player.setLinkHandler(myLinkHandler);


</script>