I have this code for reading files that are stored outside of the public folder.
$file = '/full/path/to/file.mp4';
$mime_type = mime_content_type($file);
header('Content-Type: '.$mime_type);
readfile($file);
The problem is this is working selectively. Means, it works for certain files, and for others, this code doesn't work. At first, I thought the problem was related to uploaded file (via a web form using uploadify). So I downloaded that file, and uploaded it back to a public folder and to echo from there. Strangely, here it started working.
<h2>MP4 video from public folder</h2>
<video id="video_1" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto" width="600" height="300" style="overflow:hidden" data-setup='{"example_option":true}'>
<source src="upload0/1423477304-ex4_original.mp4" type="video/mp4" />
<p class="vjs-no-js">UPDATE_BROWSER</p>
</video>
<h2>MP4 video from outside of the public folder</h2>
<video id="video_1" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto" width="600" height="300" style="overflow:hidden" data-setup='{"example_option":true}'>
<source src="filep.php?f=14&t=c&type=mp4" type="video/mp4" />
<p class="vjs-no-js">UPDATE_BROWSER</p>
</video>
I have put the above code in http://www.aidactiv.com/t3.php, and as you see, the same video file is not working in the second example.
This is not happening always, the above code works for some other videos of same mp4 format.