Hello! Faced a problem. For disposal of direct links to files, I give them through pkhp-script. Everything works perfectly with the PC, the tracks are heard without problems, but with most mobile browsers a situation arises where the media file loads for a very long time, about half a minute longer than the whole page (sometimes even longer). To return the file using the following function:
function get_file($filename, $mimetype='audio/mpeg') { if (file_exists($filename)) { header($_SERVER["SERVER_PROTOCOL"] . ' 200 OK'); header('Accept-Ranges: bytes'); header('Content-Type: ' . $mimetype); header('Last-Modified: ' . gmdate('r', filemtime($filename))); header('ETag: ' . sprintf('%x-%x-%x', fileinode($filename), filesize($filename), filemtime($filename))); header('Content-Length: ' . (filesize($filename))); header('Connection: close'); header('Content-Disposition: inline; filename="' . basename($filename) . '";'); readfile($filename); } else { header($_SERVER["SERVER_PROTOCOL"] . ' 404 Not Found'); header('Status: 404 Not Found'); } exit; } I sin on the headlines, Google did not give the working version. Thank you in advance!
UPD: I noticed that this bug is not on all versions of the android. So on 4.2 and 4.3 this problem does not occur.