История изменений
Исправление deep-purple, (текущая версия) :
А вообще на:
<?php
$speed = 20; // kbps
$path = realpath('../../Music/streamer') . '/';
if (!array_key_exists('HTTP_ICY_METADATA', $_SERVER)) {
exit('You must open this URL with audio player!');
}
header('ICY 200 OK');
header('Icy-Notice2: My radio description');
header('Icy-Name: My radio');
header('Icy-Genre: misc');
header('Icy-Url: ' . $_SERVER['HTTP_HOST']);
header('Icy-Pub: 0');
set_time_limit(0);
$chunkSize = $speed * 1024 * 8;
$tracks = glob($path . '*.mp3');
if (!$tracks) {
$tracks = array();
}
while (1) {
// shuffle all tracks
shuffle($tracks);
// each track by track
foreach ($tracks as $track) {
$fp = @ fopen($track, 'rb');
if ($fp) {
// play (streaming) track
while (1) {
$data = fread($fp, $chunkSize);
print $data;
flush();
if (strlen($data) < $chunkSize) {
fclose($fp);
break;
} else {
sleep(1);
}
}
}
}
}
Исправление deep-purple, :
А вообще на:
<?php
$speed = 20; // kbps
$path = realpath('../../Music/streamer') . '/';
if (!array_key_exists('HTTP_ICY_METADATA', $_SERVER)) {
exit('You must open this URL with audio player!');
}
header('ICY 200 OK');
header('Icy-Notice2: My radio description');
header('Icy-Name: My radio');
header('Icy-Genre: misc');
header('Icy-Url: ' . $_SERVER['HTTP_HOST']);
header('Icy-Pub: 0');
set_time_limit(0);
$chunkSize = $speed * 1024 * 8;
$tracks = glob($path . '*.mp3');
if (!$tracks) {
$tracks = array();
}
while (1) {
// shuffle all tracks
shuffle($tracks);
// each track by track
foreach ($tracks as $track) {
$fp = @ fopen($track, 'rb');
if ($fp) {
// play (streaming) track
while (1) {
$data = fread($fp, $chunkSize);
print $data;
flush();
if (strlen($data) < $chunkSize) {
break;
} else {
sleep(1);
}
}
}
}
}
Исходная версия deep-purple, :
А вообще на:
$speed = 20; // kbps
$path = realpath('../../Music/streamer') . '/';
if (!array_key_exists('HTTP_ICY_METADATA', $_SERVER)) {
exit('You must open this URL with audio player!');
}
header('ICY 200 OK');
header('Icy-Notice2: My radio description');
header('Icy-Name: My radio');
header('Icy-Genre: misc');
header('Icy-Url: ' . $_SERVER['HTTP_HOST']);
header('Icy-Pub: 0');
set_time_limit(0);
$chunkSize = $speed * 1024 * 8;
$tracks = glob($path . '*.mp3');
if (!$tracks) {
$tracks = array();
}
while (1) {
// shuffle all tracks
shuffle($tracks);
// each track by track
foreach ($tracks as $track) {
$fp = @ fopen($track, 'rb');
if ($fp) {
// play (streaming) track
while (1) {
$data = fread($fp, $chunkSize);
print $data;
flush();
if (strlen($data) < $chunkSize) {
break;
} else {
sleep(1);
}
}
}
}
}