Playing an MP3 file Playing an MP3 file
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Playing an MP3 file

Started by webhigh, August 15, 2006, 02:02:03 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

webhigh

Hello:

I've searched the forum for over an hour now and have not been able to find a good answer as to why an MP3 file will not play. I've adjust the template.php file as suggested in a topic and I can get the MP3 to auto play in the Mac OSX Theme (haven't adjusted the theme.php in the others - using this to test) but it comes up with a Click here to download link that doesn't work when you click it although the file is there because it plays.

My question is how can I get a player with all the stop - play - forward- rewind etc... to show. This shows up in the other themes but it will not play the MP3 nor does the auto start work or the media controller that's displayed.

you can view it here - http://www.whateverswhatever.com/gallery/displayimage.php?album=3&pos=1 and select a theme to see what I mean about a media player controller showing. I know Coppermine doesn't have a media player per say but I can't find any instruction on how to install one - I do have Windows media player installed on my computer along with Real Media, Quicktime & itunes. So what am I missing here ?

I also uninstalled all plugins.

Any help here greatly appreicated.

Thanks

webhigh

Ok figured out what I was doing wrong with the Click to download button - had to add a file call "download.php" to the root directory of the gallery using this code in the file itself. But how can I show a player controller ?

Thanks

<?php
//
// hack to allow downloading of pictures and movies
// see http://forum.coppermine-gallery.net/index.php?topic=6464.0
//
define('IN_COPPERMINE',true);
define('UPLOAD_PHP',true);
define('DOWNLOAD_PHP',true);

require('include/init.inc.php');

function download()
{
        global $CONFIG, $lang_upload_php, $FORBIDDEN_SET;

        $pid = (int) $_GET['pid'];

        $sql = 'select '.
                'p.filepath,'.
                'p.filesize,'.
                'p.filename,'.
                $CONFIG['TABLE_ALBUMS'].'.visibility, '.
                'p.aid as aid '.
                'from '.$CONFIG['TABLE_PICTURES'].' as p LEFT JOIN '.$CONFIG['TABLE_ALBUMS'].
                ' ON (p.aid = ' . $CONFIG['TABLE_ALBUMS'].'.aid ) '.
                ' where pid='.$pid.' and approved="YES"';

        if (!empty($FORBIDDEN_SET)) {
                $sql .= ' and '.$FORBIDDEN_SET;
        }

        $result = cpg_db_query($sql);

        // No data returned; Display an error page
        if (mysql_num_rows($result)==0) {
                mysql_free_result($result);
                cpg_die(CRITICAL_ERROR,$lang_upload_php['unknown']);
        }

        $file = mysql_fetch_assoc($result);
        mysql_free_result($result);

        // Empty output buffer
        while(ob_get_level()>0) {
                ob_end_clean();
        }

        // Send binary information to the browser
        header("Content-type: application/octet-stream");
        header("Content-disposition: attachment; filename=".$file['filename']);
        header("Content-Length: ".$file['filesize']);
        header("Pragma: no-cache");
        header("Expires: 0");
        readfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);
}

download();
?>

Joachim Müller

When offering a download link, you will of course see no player controls - that's expected behaviour, as the file then gets downloaded to the visitor's client. Coppermine doesn't have control over files once they are downloaded.