Re: MP3s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 23 Dec 2004 10:44:32 -0500, GH <garyhotko@xxxxxxxxx> wrote:
> I am working on a PHP based website and would like to offer media to
> my visitors... I have the Audio in WMA and MP3 formats... I would like
> to know how I could get them to "Stream"? inline... using PHP.... any
> advice would be greatfully appreciated

I didn't know how either but figured it out in a few minutes using
Google.  Here's what I did:

mp3.html:

<html>
<head>
<title></title>
</head>
<body>
<embed src="mp3.m3u" autostart="true" hidden="true">
</body>
</html>

//////////////////////////////////////////////

mp3.php:

<?php

$path = "/home/destiney/mp3s/Slayer";

$file = "Seasons In The Abyss.mp3";

$file_path = "$path/$file";

$fp = fopen( $file_path, 'r' );

if( $fp )
{
    $contents = fread( $fp, filesize( $file_path ) );
    fclose( $fp );
}
else
{
    die( "cannot open file: $file_path" );
}

header("Content-type: audio/mp3;\r\n");
echo $contents;

?>

//////////////////////////////////////////////

mp3.m3u ( one line ):

mp3.php



-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux