Help:Music Stream

Introduction
MusicStream is an extension that allows you to link an .mp3 or .ogg file in any MediaWiki based website.

About
MusicStream is a media extension that allows anyone who has an .mp3 or .ogg file to stream/play it using the WikiMusicGuide Free Streaming Service. You can play music without waiting for the download to complete or installing complicated web media players. Linking your .mp3 or .ogg file on your page will let your browser download the song to either save it on your disk or open it in your preferred media player.

This simple but useful application that WikiMusicGuide offers will surely give an enjoyable interactive experience to its visitors, contributors, and all independent artists and bands in the music industry.

Installation
If you have an .mp3 or .ogg file and you want to share it with WikiMusicGuide and others, please refer to the wiki text below.

Syntax &lt;musicstream&gt; url=http://yourdomain.com/song.mp3 label=Song &lt;/musicstream&gt; URL is the address of the .mp3 or .ogg file.

Label is the title of the .mp3 or .ogg file.

Demo

url=http://www.mfiles.org.uk/downloads/fur-elise.mp3 label=Beethoven - Fur Elise

Code
&lt;?php $wgExtensionFunctions[] = "wfMusicStream"; function wfMusicStream { global $wgParser; $wgParser-&gt;setHook( "musicstream", "renderMusicStream" ); } function renderMusicStream($input) { getOption($url,$input,'url'); getOption($text,$input,'label'); $output = "&lt;a href='http://www.wikimusicguide.com/stream.php?url=$url'&gt;$text&lt;/a&gt; &lt;img src='http://www.wikimusicguide.com/images/musicstream.gif' border='1' /&gt;"; return $output; }
 * 1) Using this extension will allow you to stream your music. It takes a mp3 or ogg file
 * 2) as input and outputs a m3u streaming file.
 * 3) To activate the extension, include the following at the end of your LocalSettings.php
 * 4) require_once("extensions/musicstream.php");
 * 5) Syntax:
 * 6) &lt;musicstream&gt;
 * 7) url=http://yourdomain.com/song.mp3
 * 8) label=Song
 * 9) &lt;/musicstream&gt;
 * 1) label=Song
 * 2) &lt;/musicstream&gt;

function getOption(&amp;$value,&amp;$input,$name,$isNumber=false) { if(preg_match("/^\s*$name\s*=\s*(.*)/mi",$input,$matches)) { if($isNumber) { $value=intval($matches[1]); } else { $value=htmlspecialchars($matches[1]); }   } } ?&gt;