Ir para conteúdo
Fórum Script Brasil
  • 0

Player de de áudio


lampadinha

Pergunta

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 para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,8k
×
×
  • Criar Novo...