HTML5 Radio Station Player - Documentation

Player is based on JPLayer which is open source HTML5 player with Flash fall back meaning you don't have to worry about multi-browser support. This player also allows your visitors to customize their experience, they can choose between different streams, enable or disable auto start feature, enable or disable flash as primary player and change player background. Its easy to set-up and add to any existing web site. I suggest using new folder E.g. "/player/" to deploy it and than just add popup or iframe to your existing web site.

  • Shoutcast or Icecast MP3/OGG Stream
  • PHP 5+
  • PHP CURL extension or granted permission to access remote URLs using file_get_contents() (check with host)
  • LastFM Developer API key (Optional)
  • Shoutcast/Icecast Admin access
  • Some space to cache artist images (If LastFM API key is provided) (optional)
  • Easy to Configure and Deploy (V1.02 includes setup script!)
  • Based on JPlayer (HTML5 & Flash Fall back)
  • LastFM API for showing Artists Images
  • Includes 12$ worth PHP Class Multi-server Shoutcast & Icecast Stats PHP Class
  • Includes amazing PHP caching class that works with memcache, memcached, APC (user cache) and HDD cache (default)
  • Allows your listeners to customize experience (Turn Flash on/off, Auto Play on/off, Change Background, Change Stream Quality (if you have multiple streams))
  • Creates Play-list files on the fly from configured streams
  • Best Deployed as POPUP or IFRAME so your listeners can keep browsing your site while listening
Platforms and Browsers
  • Windows: Firefox, Chrome, Opera, Safari, IE9, IE10+
  • OSX: Safari, Firefox, Chrome, Opera
  • iOS: Mobile Safari: iPad, iPhone, iPod Touch
  • Android 2.3+: Chrome, Firefox, Opera and most other mobile browsers
  • Blackberry: OS 7 Phone Browser, PlayBook Browser
Setup & Configuration
Configuration file is located in "/inc/" folder and file you need to modify is "config.php".
It is very simple to configure the player. Config file is commented so you understand what goes where.
Source of config file is bellow for example.

	// Your LASTFM API key, get it at (click on "Get an API account" to get yours)
	$conf['lastfm-api-key']		=	'API KEY HERE';

	// Set title and other defaults
	$radio['title'] 		=	'HTML5 Radio Station Player';  						// Player Title
	$radio['facebook']		=	''; 		// Link to your facebook page
	$radio['twitter']		=	'Your custom Twitter Message ';						// Twitter message

	// Radio streams for HTML5 Radio Station Player & playlist files (array)
	$radio['streams'] = array(

		// Example of streams configuration
		'Best Quality (320K)' => array(
			oga	=> '',
			mp3	=> ''

		'High Quality (192K)' => array(
			oga	=> '',
			mp3	=> ''

		'Low Quality (128K)' => array(
			oga	=> '',
			mp3	=> '',
			aac => ''

		// Must be included for current playing track
		stats => array (
			type => 'shoutcast',
			ip => '',
			port => '8000',
			pw => 'password',
			sid => 1


	// Available backgrounds (Array of Backgrounds, unlimited number supported ;))
	$background = array(
		'Neat Blue'  		=> 'images/player/background.jpg',
		'Dark Noise'		=> 'images/player/dark-noise.jpg',
		'Mixed Colors'		=> 'images/player/dark-blue.jpg'

	// Default Player Settings (PHP Array)
	$defaults = array(
		'quality' 		=> 'High Quality (192K)',		// Default Stream (name must match names set at streams array)
		'useflash'		=> 'false',       				// Use Adobe Flash Player (false/true)
		'autoplay'		=> 'false',						// Start Autoplaying (false/true)
		'background'	=> 'Neat Blue' 					// Default Player Background (name must match background set in array above)

Translating Player into multiple languages
Since version 1.07 this player supports multiple languages. The system detects browsers accepted language in ISO 639-1 standard. Than it searches for language file in "/inc/lang/{language}.php" if its found, it uses that file to change player language. I included English and Slovenian translation so you understand how it works. To learn how to name the php file for language see this web site: English translation file contents:

	/* 	This file is part of HTML5 Radio Player
	*	It allows easy translation of the player
	$lang = array(

		'init-loading'	=>	'Loading player, please wait...',
		'loading' 		=>	'Loading...',

		// No support section
		'nosupport' => 'We are sorry but your browser doesn\'t support neither Flash or HTML version of player. <br />
		Please upgrade your browser or install',

		// Navigation section
		'twitter'	=>	'Twitter',
		'like'		=>	'Like',
		'settings'	=>	'Settings',
		'close'		=>	'Close',

		// Settings
		'quality' 			=>	'Stream Quality',
		'flash'				=>	'Use Adobe Flash Player',
		'autostart'			=>	'Start playing automatically',
		'background'		=>	'Player Background',

		// Misc
		'onair'				=>	'On Air',
		'playtime'			=>	'Play time (hour:min:sec)',
		'status'			=>	'You are listening to a live stream...',
		'playlists'			=>	'Listen in your favourite player',

		'js' => array( // Javascript texts
			'likeus'		=>	'Like us on Facebook',
			'loading'		=>	'Loading, please wait...',
			'stopped'		=>	'Player stopped...',
			'volume' 		=>	'Volume'
Deploying player
To use the player, deploy it or how would you call that, simply upload files in the zip file to your web hosting provider.
If web hosting is Linux based you will have to give chmod 755 to following folders:
  • /images/artists/ (LastFM image files save here)
  • /cache/(10s cache so your server doesn't require connecting to shoutcast/icecast for every listener)
Other than that you just need to add iframe or a link with javascript popup, see bellow examples for iframe:
<!-- Set SRC value to your folder where player is located -->
<iframe src="/projects/radio-player/player/" scrolling="no" border="0" width="730" height="350"></iframe>

A link with Window POPUP deployment:
<!-- Change "/projects/radio-player/player/" to URL where you uploaded player -->
<a class="btn" href="#" onclick="'/projects/radio-player/player/','web-radio','width=730,height=350,left=40,top=40,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes,toolbar=no'); return false;">Open Player as popup</a>
Open Player as popup