1

Can someone kindly let me know what I am missing here? I want to play a video using html5 video tag by calling a php script. I don't want to display the source of the video directly.

HTML file: video.html

<video width="400" controls>
<source src="getVideo.php" type="video/mp4">
</video>

PHP file: getVideo.php

<?php
        $file_name = 'media/abc_video.mp4';
        $file_size = (string)(filesize($file_name));
        header('Content-Type: video/mp4');
        header('Content-Length: '.$file_size);
        readfile($file_name);
?>

The html page is not loading video, only a blank video player ...

I am able to play the video directly so permission should be working:

HTML file: video.html

<video width="400" controls>
<source src="media/abc_video.mp4" type="video/mp4">
</video>

Many thanks,

Ken Ly
  • 173
  • 1
  • 2
  • 8
  • have a look at answer here https://stackoverflow.com/questions/8348838/mp4-file-through-php-not-playing-as-html5-video?rq=1 – Offbeatmammal Jan 17 '16 at 23:55
  • Possible duplicate of [Play mp4 file through php in HTML5 Video Tag in Chrome?](https://stackoverflow.com/questions/24596450/play-mp4-file-through-php-in-html5-video-tag-in-chrome) –  Sep 06 '17 at 18:52

0 Answers0