Extension talk:Mp3
Add topicAny user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Mp3 streams
[edit]Thank you for this extension ! It works fine for streamed mp3 like webradio :] Greudin 00:32, 17 October 2006 (UTC)
Works great, but first click doesnt work
[edit]After a page loads, the first click of the play button doesnt work. I have now seen that, its IE which requires the extra click. We can get around this by using a javascript code technique: [1] and here: [2] A tool for working this out: [3]
The main thing is to get rid of that extra click. That would be nice, if it can be done.
Also the high CPU usage with lots of extensions on the same page should be checked. Is there any way we can get the code for this flash player?
--Matt57 05:30, 21 October 2006 (UTC)
Click problem will not change
[edit]document.write('...')
That's silly and will not work for people with JavaScript disabled !
I'm not sure, but for applet Opera make the same thing. I need to click first on it before to use it.
For the high CPU usage, I don't know. I've problem on page with more than 15 or 20 mp3. Just reload (F5) and it's ok. The source code is not available, I think the author of the flash script says on his site he will not show the source code, because a lot of people ask for many many features and he wants to let it as simple and light as possible.
--Iubito 05:27, 30 October 2006 (UTC)
- The CPU usage is a sad thing. If it gets beyond 15 players, the slowing effect is very bad. I wish we could get the code somehow. I'm sure its a silly issue. I've emailed the author but didnt get a response.
Ogg Vorbis
[edit]This looks really cool, but what I really need is to play ogg files, not mp3. Does anyone know if that functionality is available anywhere? Bob the Hamster 19:38, 8 November 2006 (UTC)
- Hi Bob, this player doesn't play ogg :( I too would like a ogg player... if you find one, tell me ! --Iubito 13:10, 17 November 2006 (UTC)
- There's always the Wikipedia implementation.
- --Pcj 15:42, 12 January 2007 (UTC)
- Where ? --Iubito 07:18, 13 February 2007 (UTC)
External Links
[edit]This player works awesomely well for MP3 files already uploaded into the wiki's system, but is there a way to make externally linked files work? I see that it's supposed to, given the source, but I just get a PHP error whenever I try. - ScarredSun 19:47, 1 January 2007 (UTC)
- What error do you get ? All my mp3 are hosted on an external server and I give the http://... url to the player. --Iubito 13:03, 12 January 2007 (UTC)
- Fatal error: Call to a member function exists() on a non-object in /home/sonicret/public_html/info/extensions/mp3.php on line 53. Get this with both a leading http:// and without. - ScarredSun 21:55, 12 January 2007 (UTC)
- This is a problem at your end. The external link mp3 work fine on my wiki (1.6.8). Disable your other extensions and see what it does. --Matt57 17:48, 20 January 2007 (UTC)
- I figured out the problem--you can't use encoded URLs! Otherwise, there's no problem. - ScarredSun 10:23, 23 January 2007 (UTC)
- This is a problem at your end. The external link mp3 work fine on my wiki (1.6.8). Disable your other extensions and see what it does. --Matt57 17:48, 20 January 2007 (UTC)
- Fatal error: Call to a member function exists() on a non-object in /home/sonicret/public_html/info/extensions/mp3.php on line 53. Get this with both a leading http:// and without. - ScarredSun 21:55, 12 January 2007 (UTC)
1.8.3?
[edit]I'm having trouble getting this to work in 1.8.3...it's still in my LocalSettings and I haven't moved the extension itself...is this working for anyone else?
--Pcj 18:00, 9 January 2007 (UTC)
- I update from 1.8.2 to 1.9, it still works. --Iubito 13:04, 12 January 2007 (UTC)
Note that the above conversation may have been edited or added to since the transfer. If in doubt, check the edit history.
Automatic Start
[edit]Is it possible to start a MP3-file automatically if someone open a specific site? --Ulli1105 19:43, 2 October 2007 (UTC)
Invalid File names & HTTPS
[edit]--Axelseaa 13:42, 16 October 2007 (UTC) We have had a few users attempt to enter invalid filenames such as ###, php will bomb with a fatal error. I also made a change to allow for https links. To correct this, i've added the following in the renderMp3 function:
# The callback function for converting the input text to HTML output function renderMp3($input) { global $wgScriptPath, $wgUploadPath; //$input = "filename.mp3"; $arr = explode('|', trim($input)); $addDLlink = isset($arr[1]) && ($arr[1] == 'download'); $input = $arr[0]; $img = Image::newFromName($input); $mp3 = ''; $bgcolor = 'FFF8DC'; //You can change it, of course :-) // If invalid filename is entered, bail out. ex. ### if (!isset($img)) { return '<div class="noprint">Invalid Filename ('.$input.').</div>'; } //The parameters for object and embed # File uploaded or external link ? if (!$img->exists()) { //Must be http:// or https://... URL if (substr($input,0,7) == 'http://' || substr($input,0,8) == 'https://') $mp3 = $input; } else $mp3 = $img->getURL(); if ($mp3 == '') return '<div class="noprint">Fichier manquant : '.$input.'<br />' .'Missing ressource: '.$input.'</div>'; unset($img); $output = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ' . 'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ' . 'width="150" height="20" id="dewplayer" align="middle">' . '<param name="allowScriptAccess" value="sameDomain" />' . '<param name="movie" value="'.$wgScriptPath.'/extensions/dewplayer.swf?son='.$mp3.'&bgcolor='.$bgcolor.'" />' . '<param name="quality" value="high" />' . '<param name="bgcolor" value="FFF8DC" />' . '<embed src="'.$wgScriptPath.'/extensions/dewplayer.swf?son='.$mp3 .'&bgcolor='.$bgcolor.'" quality="high" bgcolor="FFF8DC" width="150" height="20" ' .'name="dewplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" ' .'pluginspage="http://www.macromedia.com/go/getflashplayer">' .'</embed>' .'</object>'; if ($addDLlink) { $output .= '<a href="'.$mp3.'" title="Download">' .'<img src="'.$wgScriptPath.'/skins/common/images/Download.gif" alt="Download" />' .'</a>'; } return $output; }
getting 403 error
[edit]I added this extension to a 1.9.3 mediawiki instalation.
It gets an 403 error at
http://siteurl/w/extensions/dewplayer.swf?son=/w/images/a/a9/music.mp3&bgcolor=FFF8DC
and the player appears without buttons, just a rectangle.
I also get a forbidden 403 at http://siteurl/w/extensions/dewplayer.swf
however both the folder and the file are chmod 755
Any ideas? Thank you!
it may be a permission issue - dewplayer.swf is not accessible to the web server. --Sam Watkins
Testing
[edit]Hi this is a testing purpose
Couldn't get dewplayer to work on mediawiki 13.1 and 13.2, so am using mini player version!
[edit]Hi, I loved the look of this plugin but couldn't get it working.
So I've modified this to use mini mp3 player which is really quick!
Also, helps to refresh the page while your trying to get this working as per http://kb.siteground.com/article/How_to_clear_the_page_cache_in_MediaWiki.html :-)
<?php
# Stream MP3 with http://flash-mp3-player.net/players/mini/ mini mp3 player
#
# http://flash-mp3-player.net/players/mini/ download
#
# Tag :
# <mp3>uploaded filename.mp3 or URL</mp3>
# <mp3>uploaded filename.mp3 or URL|download</mp3> adds an icon with link to download the mp3
# Requires :
# player_mp3_mini.swf in the $wgScriptPath/extensions directory
# download.gif in the images ($wgUploadPath) directory : an image of your choice
#
# To activate the extension :
# - include it at the end of your LocalSettings.php : include("extensions/mp3.php");
# - add .mp3 in the extension list if you want to allow mp3 uploads :
# $wgFileExtensions = array('png','gif',...,'mp3');
#
# Enjoy !
$wgExtensionFunctions[] = 'wfMp3';
//change here for your wiki
$wgExtensionCredits['parserhook'][] = array(
'name' => 'mp3',
'description' => '['.$wgScriptPath.'/extensions/player_mp3_mini.swf' .
'] is light and streams your mp3',
'author' => 'Sylvain Machefert, Sam J Watkins',
'url' => 'http://www.mediawiki.org/wiki/Extension:Mp3'
);
function wfMp3() {
global $wgParser;
$wgParser->setHook('mp3', 'renderMp3');
}
# The callback function for converting the input text to HTML output
function renderMp3($input) {
global $wgScriptPath, $wgUploadPath;
//$input = "filename.mp3"
$arr = explode('|', trim($input));
$addDLlink = isset($arr[1]) && ($arr[1] == 'download');
$input = $arr[0];
$img = Image::newFromName($input);
$mp3 = '';
$bgcolor = 'FF0000'; //You can change it, of course :-)
//The parameters for object
# File uploaded or external link ?
if (!$img->exists()) {
//Must be http://... URL
if (substr($input,0,7) == 'http://')
$mp3 = $input;
} else
$mp3 = $img->getURL();
if ($mp3 == '')
return '<div class="noprint">missing MP3 file, file not found: '.$input.'<br />';
unset($img);
$output = '<!-- Change here for your wiki--> <object type="application/x-shockwave-flash" data="'.$wgScriptPath.'/extensions/player_mp3_mini.swf" width="200" height="20">'
. ' <param name="movie" value="'.$wgScriptPath.'/extensions/player_mp3_mini.swf" />'
. '<param name="bgcolor" value="#ff0000" />'
. '<param name="FlashVars" value="mp3='.$mp3.'" />'
.'</object>';
if ($addDLlink) {
$output .= '<a href="'.$mp3.'" title="Right click to download">'
.'<img src="'.$wgUploadPath.'/download.gif" alt="Right click to download" />'
.'</a>';
}
return $output;
}
?>
Please let me know how you get on! --SamWatkins 19:14, 3 April 2009 (UTC)
- I made some upgrades to the one above, made the background transparent by default, but added options for bg color and player color, there is a bug in it though something about invalid url's make it crash, I'm not good with php so hopefully someone else will be able to fix it
<?php
# Stream MP3 with http://flash-mp3-player.net/players/mini/ mini mp3 player
#
# http://flash-mp3-player.net/players/mini/ download
#
# Tag :
# <mp3>uploaded filename.mp3 or URL</mp3>
# <mp3>uploaded filename.mp3 or URL|download</mp3> adds an icon with link to download the mp3
# Requires :
# player_mp3_mini.swf in the $wgScriptPath/extensions directory
# download.gif in the images ($wgUploadPath) directory : an image of your choice
#
# To activate the extension :
# - include it at the end of your LocalSettings.php : include("extensions/mp3.php");
# - add .mp3 in the extension list if you want to allow mp3 uploads :
# $wgFileExtensions = array('png','gif',...,'mp3');
# Enjoy !
$wgExtensionFunctions[] = 'wfMp3';
//change here for your wiki
$wgExtensionCredits['parserhook'][] = array(
'name' => 'mp3',
'description' => '['.$wgScriptPath.'/extensions/player_mp3_mini.swf' .
'] is light and streams your mp3',
'author' => 'Sylvain Machefert, Sam J Watkins',
'url' => 'http://www.mediawiki.org/wiki/Extension:Mp3'
);
function wfMp3() {
global $wgParser;
$wgParser->setHook('mp3', 'renderMp3');
}
# The callback function for converting the input text to HTML output
function renderMp3( $input, $argv ) {
global $wgScriptPath, $wgUploadPath;
//$input = "filename.mp3"
$arr = explode('|', trim($input));
$addDLlink = isset($arr[1]) && ($arr[1] == 'download');
$input = $arr[0];
$color = '50A6C2';
$bg = '';
foreach( $argv as $name => $value )
{
if ($name == 'color') $color = $value;
if ($name == 'bg') $bg = $value;
}
$back = '<param name="wmode" value="transparent">';
if ($bg == ''){
$back = '<param name="wmode" value="transparent">';
}
else {
$back = '<param name="bgcolor" value="#'.$bg.'"/>';
}
$img = Image::newFromName($input);
$bgcolor = ''; //You can change it, of course :-)
//The parameters for object
# File uploaded or external link ?
if (!$img->exists()) {
//Must be http://... URL
if (substr($input,0,7) == 'http://')
$mp3 = $input;
} else
$mp3 = $img->getURL();
if ($mp3 == '')
return '<div class="noprint">missing MP3 file, file not found: '.$input.'<br />';
unset($img);
$output = '<object type="application/x-shockwave-flash" data="'.$wgScriptPath.'/extensions/player_mp3_mini.swf" width="200" height="20">'
. '<param name="movie" value="'.$wgScriptPath.'/extensions/player_mp3_mini.swf" />'.$back.'<param name="buttoncolor" value="#000000" /><param name="slidercolor" value="#000000" />'
. '<param name="FlashVars" value="mp3='.$mp3.'&bgcolor='.$bg.'&loadingcolor='.$color.'&buttoncolor='.$color.'&slidercolor='.$color.'" />'
.'</object>';
if ($addDLlink) {
$output .= '<a href="'.$mp3.'" title="Right click to download">'
.'<img src="'.$wgUploadPath.'/download.gif" alt="Right click to download" />'
.'</a>';
}
return $output;
}
?>
- maybe we should make this into it's own extension redekopmark 16:56, 21 September 2010 (UTC)
1.18.1
[edit]Doesn't work on 1.18.1 but MiniMp3 extension does. Its skin is awful, however, but merely replace the Minimp3 swf by dewplayer.swf allows to use the later.