これは、phpを介してmp3ファイルをストリーミングするための私のphpコードです
set_time_limit(0);
$dirPath = "path_of_the_directory";
$songCode = $_REQUEST['c'];
$filePath = $dirPath . "/" . $songCode . ".mp3";
$strContext=stream_context_create(
array(
'http'=>array(
'method'=>'GET',
'header'=>"Accept-language: en\r\n"
)
)
);
$fpOrigin=fopen($filePath, 'rb', false, $strContext);
header('content-type: application/octet-stream');
while(!feof($fpOrigin)){
$buffer=fread($fpOrigin, 4096);
echo $buffer;
flush();
}
fclose($fpOrigin);
Mac Mini およびその他すべての PC では動作しますが、iPad および iPhone では動作しません。ストリーミングでさえ、他のすべてのスマートフォンで機能しています。あなたの助けをいただければ幸いです。
ありがとう