treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Non stop mp3 player

  • [link deleted]

    I want the mp3 flash player in the top of the site never stop playing the music while browsing other pages (inside the page). What's the best way to do this? Iframe? Ajax?

    Thanks
  • The "best" way to do it is have a small pop up window that your user can open then use the player in it.

    Iframes and aJax - I would go with ajax before an iframe but both are pants really.

    As a word of advice on a user interaction front - most people when browsing the web are listening to music - so do not autoplay your site's music when the user loads the window - because if it clashes with their music it will sound terrible and their first reaction is to close your window. This is especially relevant for a site promoting music, as the visitors would most definitely be "muso's" (english slang for music lovers...) listening to something :)
  • Yeah, i think popup is the best way. Already implemented!

    Thanks for your help. :)
  • Another question..

    <body onload=\"window.open('/radio.htm','radio','toolbar=no, location=no, directories=no, status=no, menubar=no, width=300, height=100, top=250, left=310 resizeable=no');\">


    It will open the poup window every time that body is loaded, so i want to implement a function that:
    - verifies if the popup is already opened (to not reload)
    - and load-it only 1 time in one session (for the people that closed it)

    Thanks!!
  • I would personally let the user open the window... it can be seen as a little rude if you force it on people :)
  • Yeah, I agreed with you, but it was a feature request by the client.

    I write a little code to my question above.

    <?php
    $firstVisit = 'false';
    if(!isset($_COOKIE['welcome']) && empty($_COOKIE['welcome'])){
    setcookie(\"welcome\", \"true\", time()+1000);
    $firstVisit = 'true';
    }
    ?>


    <body<? if ($firstVisit == 'true') {
    echo \" onload=\\"window.open('/radio.htm','newsletter','toolbar=no, location=no, directories=no, status=no, menubar=no, width=300, height=100, top=250, left=310 resizeable=no');\\">\";

    } else {

    echo \">\"; }?>


    Its working, thanks.