radio player

Discussion in 'PHP' started by TobyCS, Aug 10, 2009.

  1. #1
    basically i want to some how have a webplayer.php and a options menu. on default it will load a flash player but if they put in the options they can set which player they want whether its wmp, flash, etc, etc and whether it auto starts. how would i do this?
     
    TobyCS, Aug 10, 2009 IP
  2. Dennis M.

    Dennis M. Active Member

    Messages:
    119
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Well it depends. Is the flash player going to take options from the address as well? If so, you have to make sure you code the actionscript to coincide with the PHP script. That confusion aside, you could use a switch for a given variable in the URL. Try something like this:

    
    <?php
    // For sake of example, I'll just use a define for the codes right now..
    define("FLASH_PLAYER_CODE","Whatever the code is for the flash player should go here!");
    define("WM_PLAYER_CODE","WM Player code goes here!");
    
    // Let's use a switch to determine what we're doing!
    switch(strtolower($_GET['player'])){
      default: // This will be the flash player. If the var is unset, set to ?player=flash, or unknown this will be used
        print FLASH_PLAYER_CODE;
      break;
      case 'wmp':
        print WM_PLAYER_CODE;
      break;
      case 'whateverelse':
        // Code
      break;
      case 'andsoon':
        // Code
      break;
    }
    ?>
    PHP:
    Note that this can be set in the middle of the page. So anything that would look the same regardless of the player type can be set only one time, then run this code to simply change the player! I hope the concept makes sense :)

    Side-note: The way this player will work is webplayer.php?player=DEFINED_PLAYER. DEFINED_PLAYER only needs to be defined as a case '': break; in order to function properly.

    Good luck.

    Regards,
    Dennis M.
     
    Dennis M., Aug 10, 2009 IP
  3. TobyCS

    TobyCS Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I already have done this but I am looking to make some sort of panel so they can set like the default one they want to use and set default parameters like auto-start, etc? I assume that's done with php and cookies but never done it before.
     
    TobyCS, Aug 11, 2009 IP
  4. TobyCS

    TobyCS Peon

    Messages:
    43
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    also how can i make it so if it was like player.php?player=wmp&quality=high it would use a different source?
     
    Last edited: Aug 12, 2009
    TobyCS, Aug 12, 2009 IP