Jump to content
Fórum Script Brasil
  • 0

Player de de áudio


lampadinha

Question

Index.php

<?php
$site = $_SERVER['HTTP_HOST'];
$dir_name = dirname($_SERVER['PHP_SELF']);
$current_url = "http://$site$dir_name/";
$asx = "asx.php";
 
$radio = new szsystem(''.$current_url.''.$asx.''); //URL e caminho do (asx.php)//
 
class szsystem { 
var $attribs;
function __construct($src) {
//$this->attrib('pluginspage','http://www.microsoft.com/Windows/MediaPlayer/');
//uncomment line above when really needed
$this->attrib('type','application/x-mplayer2');
$this->attrib('width','468');
$this->attrib('height','60');
$this->attrib('loop','False');
$this->attrib('autostart','True');
$this->attrib('showstatusbar','false');
$this->attrib('volume','80');
$this->attrib('src',$src);
}
 
function attrib($name, $value) {
$this->attribs[$name] = $value;
}
 
function __toString() {
foreach($this->attribs as $name => $value) {
$tmp .= " $name='$value'";
}
return "<embed$tmp></embed>";
}
}
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="somzuada" content="no-cache">
 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HG SISTEMAS</title>
 
<style type="text/css">
<!--
body,td,th {
font-family: Georgia, Times New Roman, Times, serif;
}
-->
</style></head>
<body>
 
<center>
  <p>&nbsp;  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>
    <?=$radio?>
  </p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</center>
</body>
</html>

asx.php

<?php
header("Content-Type: audio/x-ms-asf"); 
header("Content-Disposition: filename=radio.asx"); 
header("Pragma: no-cache");
header("Cache: no-cache");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
$site = $_SERVER['HTTP_HOST'];
$dir_name = dirname($_SERVER['PHP_SELF']);
$current_url = "http://$site$dir_name/";
$dir = 'musicas'; //Pasta das musicas//
$url = ''.$current_url.''.$dir.'';
$ext = array('mp3', 'wma'); //Extenções de áudio permitidas//
$files = array();
foreach(new DirectoryIterator($dir) as $item) {
if($item->isFile() && in_array(strtolower(substr($item, -3)), $ext)) {
$files[] = "$url/$item";
}
}
mt_srand((double)microtime()*1000000); //randoniza as musicas//
                shuffle($files);
print join("\n", $files);
?>
Não esqueça da pasta (musicas)
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.1k
    • Total Posts
      652k
×
×
  • Create New...