Proxy SSL para streaming de audio http a https (Icecast / ShoutCast) Imprimir

  • 5

#SHOUTcast / Icecast no es compatible con SSL / HTTP. El servicio shoutcast en puertos como 8000 es un servidor sin cifrar para HTTP e ICY. Por lo tanto, Shoutcast necesita una transmisión HTTP proxy / retransmitida a HTTPS.

#Crear un archivo en un servidor con un dominio activo y con un certificado SSL activo y crear un sub directorio stream y dentro de el un archivo index.php

<?php 

/*

Icecast / Shoutcast MP3 Radio Stream 

Shoutcast V1 (http://shoutcast-server-ip:port/) 

Shoutcast V2 (http://shoutcast-server-ip:port/streamname) 

Icecast V2 (http://icecast-server-ip:port/streamname)

*/

header('Content-Type: audio/mpeg');

$server = "[Server-IP-Address]";

$port = "[Port]";

$mount = "[Mount-Point]";

 

// HTTP Radio Stream URL with Mount Point

$url = "http://".$server.":".$port."/".$mount;

// Open Radio Stream URL

// Make Sure Radio Stream [Port] must be open / allow in this script hosting server firewall 

$f=fopen($url,'r');

// Read chunks maximum number of bytes to read

if(!$f) exit;

while(!feof($f))

{

echo fread($f,128);  

flush();

}

fclose($f);

 

?>

#Dentro de ese directorio crear un archivo .htaccess – stream/.htaccess

<FilesMatch "mp3$">

    SetHandler application/x-httpd-php5

</FilesMatch>

<IfModule mod_rewrite.c>

RewriteEngine On

#RewriteBase /

# Redirect MP3 to PHP

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*).mp3$ index.php [L]

</IfModule>

#Entonces, si aloja estos archivos en un servidor habilitado para HTTPS en la carpeta "stream" podrá acceder al streaming con https , para ello modificar desde donde carga su reproductor el audio por lo siguiente (reemplazando domain.com por su dominio)

#https://www.domain.com/stream/audio.mp3


¿Le ha resultado útil esta respuesta?

« Atrás

["\r\n