JPlayer XSPF Playlist Player
for Zina

20130523: Player no longer functions as I no longer use ZINA to access my music remotely

This page's logic should still apply, however.

JPlayer XSPF Playlist Player
[for Zina] v. 0.1.1

tested on:

News

[2010.12.11]
Added ability (configurable option) to display HTML5/Flash distinguisher and MP3/OGG distinguisher.

[2010.12.11]
Realized that the demo doesn't work in IE or FF, just Chrome. I'm working on determining why. Stay tuned.
^^ Corrected! It was the "swfPath" in "js/jquery.jplayer.min.js". Changed from "js" to "zina/jplayer/js" and we seem good. Updating source as we speak. [Done]

Source / Download

Implementations

This site uses css/html produced by the actual implementation, but is not dynamically linked to Zina like the implementation below is.

About

This page demonstrates the JPlayer XSPF Playlist Player (for Zina), by Cornbread Web Design (A division of Chapman IT).

This code was written because Zina's bundled player is flash-based...and I think HTML5 is more fun. Really, I think it is more resource friendly and doesn't require 3rd party plugins. The first implementation is intended for integration with Zina. In theory, any XSPF playlist could be played with this code.

_Props_
I extended Zina with this player, and coded the XSPF parsing...but that was the easy part. I couldn't have done it without lots of help:

Zina » Wonderful software which enables you to access (and manage, potentially) your music library through a web browser.
JPlayer » Awesome HTML5 (flash fallback) Audio/Video player with playlist capability which is the foundation upon which this project was built; and the bricks comprising the walls, for that matter.

Using the Code

A basic grasp of PHP will help, if not be necessary, to use this code. You may be able to scrape by if you don't know Javascript (like me). HTML and CSS can't hurt, either.

Basically, though, assuming you are running (or, have access to) a web server with Zina installed and working, it should be doable. I have Zina installed in standalone mode. If yours is integrated into another site, you may have to make some minor path changes.

To get JPlaying with Zina, you will need to make the following changes:

_zina settings_
    Music Files Section
  1. Allow Playing of Files > True
  2. Allow Downloads > True?
  3. Playlist format to return > XSPF
  4. Flash player > None
_file changes_
  1. Download source files and extract to a temporary directory. The file struction of the files aims to mirror the zina structure for easier integration.
  2. Back up your [zina_wwwroot]/zina/index.php file
  3. Copy jp_rand.php to [zina_wwwroot]
  4. Copy zina/index.php* to [zina_wwwroot]/zina (you just backed this up or renamed it, right?)
  5. Copy zina/jplayer (directory) to [zina_wwwroot]/zina
*Notice: The only code changed was from [zina_wwwroot]/zina/index.php [around line 6160]. I added the following two lines of code:

include('jplayer/index.php');
exit;

to the top of the "zina_send_playlist_content" function's "elseif ($type == 'xspf')" section.
That's it!

_usage_
You just browse to your Zina implementation, and click a 'speaker' or any other link which normally prompted the download of a XSPF playlist or the instantiation of a Zinamp player.

_known problems_
There is a problem when using the playlist when you are logged in. It has something to do with session variables, as far as I can tell. If JPlayer shows no playlist items, you'll need to go back to your Zina page and log out. Disabling the only available 'configurable option' (shuffle playlist -- see below) may help, too.

_configurable options_
There is currently only one configuration options at the top of [zina root]/zina/jplayer/index.php which allows you to disable offering the 'Shuffle Playlist' option. Fancy, huh?

_reverting_
I didn't break your site, did I? If you want to change things back to the way they were, you can delete the files added during the 'file changes' steps above, then restore the backed up [zina_wwwroot]/zina/index.php that you backed up (or, delete the two lines specified in the 'Notice' above -- this may work). You should be good to go!

Contact

Let me know if you have any trouble. Email me(thenickchapmanATgmail.com) or comment on the Zina SourceForge > Feature Request > HTML5 / JPlayer Implementation thread.

Other Projects

-nc
Site development and hosting by