Thread: I can't play mp3s on my website.....

  1. #1
    Geo Geo Geo-Fry
    Join Date
    Feb 2003
    Posts
    116

    I can't play mp3s on my website.....

    Okay, so I was going to make a webpage where you could get the lyrics to/listen to a bunch of Linkin Park songs since they are so awesome and everything. And I decided to use my 1337 php skills (or lack thereof) to make it all in one page, and I did it. But the HTML side of playing the songs doesn't seem to be working. First I tried this script, which shows the little control thing, but won't play the songs:
    PHP Code:
    echo "<embed src=\"http://geofryland.kicks-ass.net/music/songs/$song.mp3\" height=\"24\" width=\"275\" autostart=\"true\" loop=\"true\">\n";
    echo 
    "<noembed>\n";
    echo 
    "<bgsound src=\"http://geofryland.kicks-ass.net/music/songs/$song.mp3\" height=\"24\" width=\"275\" autostart=\"true\" loop=\"true\">";
    echo 
    "</noembed>"
    Of course, $song has the song name and the paths are right and such, I've verified all of that. It just won't play.

    So I searched around the internet, and found another script that lets you play a song when you click the link for it. It worked just fine on the site that showed it, so I thought that I'd try it. Here's the code for it.
    PHP Code:
    echo "<a onclick=\"self.location=http://geofryland.kicks-ass.net/music/songs/$song.mp3'; return false\" href=\"#\">Click here to play $song</a>"
    On the site that showed this version, when I clicked the link Windows Media Player popped up and played the song. But on my website, it just tries to open the .mp3 file in internet explorer, and gets a 404. Again I have verified paths and names, which leads me to believe that maybe I need to configure something in me Apache config file. Any ideas anyone?

    <edit>
    Here's the code for the page:
    PHP Code:
    <html>
    <head>
    <title>Geo-Fry Land - Now Playing: <?php $_GET['song']; ?></title>
    </head>
    <body bgcolor="black" text="white">


    <?
    if ($_GET["version"] == "") {
    ?>

    <form name="songs" action="index.php" method="get">
    <pre>
    Action:    <select name="type" size="1">
    <option value=Listen>Listen
    <option value=Lyrics>Lyrics
    <option value=Download>Download
    </select>
    Song Name: <select name="song" size="1">
    <option value="Crawling">Crawling <!--20-->
    <option value="Faint">Faint
    <option value="In the End">In the End
    <option value="Its Going down">Its Going Down
    <option value="Numb">Numb
    <option value="One Step Closer">One Step Closer
    <option value="Papercut">Papercut
    <option value="Points of Authority">Points of Authority
    <option value="Pushing me Away">Pushing me Away
    <option value="Runaway">Runaway
    <option value="Somewhere I Belong">Somewhere I Belong
    <option value="A Place for my Head">A Place for my Head
    </select>
    <input type="hidden" value="1" name="version">
    <input type="submit" value="Go!">
    </pre>
    </form>

    <?
    } elseif ($_GET["version"] == "1") {
    //40
        
    $song strtolower($_GET['song']);
        
    $type strtolower($_GET['type']);

        if (
    $type == "listen") {

            echo 
    "<embed src=\"http://geofryland.kicks-ass.net/music/songs/$song.mp3\" width=\"275\" autostart=\"true\" loop=\"true\">\n";
            echo 
    "<noembed>\n";
            echo 
    "<bgsound src=\"http://geofryland.kicks-ass.net/music/songs/$song.mp3\" height=\"24\" width=\"275\" autostart=\"true\" loop=\"true\">";
            echo 
    "</noembed>";

    //        echo "<a onclick=\"self.location='http://geofryland.kicks-ass.net/music/songs/$song.mp3'; return false\" href=\"#\">Click here to play $song</a>";
        
    } elseif ($type == "download") {

            echo 
    "Click <a href=\"../downloads/$song.zip\">here</a> to download $song.";
        } else {

            echo 
    "Lyrics for $song coming soon.";

        }
    }
    ?>

    </body>
    </html>
    </edit>
    Last edited by Geo-Fry; 12-07-2003 at 12:39 PM.
    "You can lead a man to Congress, but you can't make him think."
    "The Grand Old Duke of York
    -He had ten thousand men.
    -His case comes up next week."
    "Roses are red, violets are blue, I'm schizophrenic, and so am I."
    "A computer once beat me at chess, but it was no match for me at kick boxing."
    "More and more of our imports are coming from overseas."
    --George W. Bush
    "If it weren't for electricity, we'd all be wacthing TV by candlelight."
    --George W. Bush

  2. #2
    Registered User glUser3f's Avatar
    Join Date
    Aug 2003
    Posts
    345
    no please no, websites with embeded music just ........ me off, I never come back, and I'm sure many have similar feelings...

  3. #3
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    agreed, make them links
    PHP and XML
    Let's talk about SAX

  4. #4
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    I kinda third that... I dont' mind one embedded song as long as I have control over it and autoplay is set to false...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  5. #5
    Geo Geo Geo-Fry
    Join Date
    Feb 2003
    Posts
    116
    Hmm, its seems you are misunderstanding, the page is soley for listening to the songs, you would only go there if you wanted to hear them anyway, not as background music.
    Now that we have the purpose out of the way, anyone have any suggestions for getting this to play? (By the way, when I access the page now, it has a popup that says "The data that the plugin requested, did not download successfully." [Including the misused comma, stupid M$ people.])
    "You can lead a man to Congress, but you can't make him think."
    "The Grand Old Duke of York
    -He had ten thousand men.
    -His case comes up next week."
    "Roses are red, violets are blue, I'm schizophrenic, and so am I."
    "A computer once beat me at chess, but it was no match for me at kick boxing."
    "More and more of our imports are coming from overseas."
    --George W. Bush
    "If it weren't for electricity, we'd all be wacthing TV by candlelight."
    --George W. Bush

  6. #6
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    umm... genius... don't you think it's probably slightly illegal to play LP songs on your website without their permission??

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Originally posted by Geo-Fry
    [B]Hmm, its seems you are misunderstanding, the page is soley for listening to the songs, you would only go there if you wanted to hear them anyway, not as background music.
    first, you should take ober's advice... second of all, a simple link to the file itself should suffice... why dedicate an entire page to the song file...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    considering LP funds a dedicated server for p2p for their music i cant see them caring.

  9. #9
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    ^ how much control do they have over that network?
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  10. #10
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    Originally posted by RoD
    considering LP funds a dedicated server for p2p for their music i cant see them caring.
    Umm... that is their own server. Not this guy's or the one he hosts with. You could get into serious legal trouble by playing their music in a web arena where people could potentially get the music for free.

    It's the same concept as having a radio station. You can't just buy a tower and a frequency and play whatever you want. You have to pay licensing fees to play different types of music. It's an industry. Money flows through it. You can't just do whatever you want. And trust me, if you don't think you'll get caught, you're being naive.

  11. #11
    PC Fixer-Upper Waldo2k2's Avatar
    Join Date
    May 2002
    Posts
    2,001
    Originally posted by ober5861
    Umm... that is their own server. Not this guy's or the one he hosts with. You could get into serious legal trouble by playing their music in a web arena where people could potentially get the music for free.

    It's the same concept as having a radio station. You can't just buy a tower and a frequency and play whatever you want. You have to pay licensing fees to play different types of music. It's an industry. Money flows through it. You can't just do whatever you want. And trust me, if you don't think you'll get caught, you're being naive.
    lol, that reminds me off a friend of mine...he thought it'd be funny to jam a christian radio station broadcasting from outside of town and put out his own signal....yeah, he got into some serious shiet over that one.
    PHP and XML
    Let's talk about SAX

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Vista core audio apis for playing mp3s
    By elmutt in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2008, 04:12 PM
  2. how to play play and stop wav files
    By cnu_sree in forum Linux Programming
    Replies: 4
    Last Post: 08-14-2006, 11:11 PM
  3. pls post here tricks that you know of in C/C++, thanks
    By mickey in forum C++ Programming
    Replies: 55
    Last Post: 06-12-2003, 04:28 PM
  4. Gui Class With Tic Tac Toe
    By xxYukoxx in forum C++ Programming
    Replies: 1
    Last Post: 06-01-2003, 04:28 PM
  5. Cribbage Game
    By PJYelton in forum Game Programming
    Replies: 14
    Last Post: 04-07-2003, 10:00 AM