These are my settings:
Web Server: Apache/2.4.25
Web structure:
/
|__Video/
|__ test.mp4
|__play.php
Currently I am exposing all my videos on my server putting directly the video directory in the apache directory.
What I want to obtain is to move the video outside the Apache directory (assume no permission problems) and trasmit only the requested video through a GET request to play.php
like: GET play.php?req=test.mp4
Currently I've written the following code:
$name = $_GET['req']
header('Accept-Ranges: bytes');
header('Content-Length: ' . filesize($name));
header('Content-Type: ' . mime_content_type($name));
header('Content-Disposition: filename="'.$name.'"');
readfile($name);
exit;
What is missing? Why do I get "No supported video media" when I try to access to the file using play.php? Using "mysite.com/Video/test.mp4" I can access directly to the media without problems.
I realized that if I wait a sufficient long time, the browser fully download the file and reproduce it. What I can't obtain is the streaming of the file.