If your jplayer instance DIV is called id="jquery_jplayer_1", and your elements holding the music info are as follows:
<div class="jp-track-info">
<span class="jp-track-title"></span> <small><span class="jp-track-artist"></span></small>
</div>
You can insert the music's info into these elements with the following code:
var current = myPlaylist.current,
playlist = myPlaylist.playlist;
$.each(playlist, function (index, obj) {
if (index == current) {
$('.jp-track-title').text(obj.title);
$('.jp-track-artist').text('by ' + obj.artist);
}
});
});
Of course, you need to save this info in your playlist in order to be able to retrieve it later. You can set the info statically per page, but in this day and age most sites are driven by dynamic content management systems, so you probably want to load the info dynamically as well.
In my site setup (
www.tjoonz.com) you can browse mixtapes. The buttons to play a mixtape look the same on every page, but the code behind it inserts that mixtape's title, artist, url and genre into the jPlayer playlist. I use the following code:
$("body").on("click", ".jplayer-playnow", function (e) {
e.preventDefault();
myPlaylist.add({
title: $(".single-title-mixtape").text(),
artist: $(".single-title-artist").text(),
genre: $(".jplayer-playnow span").attr("class"),
mp3: $(this).attr("href"),
poster: $(".wp-post-image").attr("src")
}, true); // true value here makes the newly added track play immediately
} );
As you can see in the example above, the "title: <title>" is dynamically taken from the page the user is currently on. You can change this to something hard-coded if you want that instead.