I want to play a video in the path of a file located in the hard disk out apatch server from a php file in the apatch server, knowing that I am using xampp, I tried to write the code as follows.
<?php
$src="file://E:/Vtest/Fle.mp4";
?>
<video src="<?php echo $src;?>" autoplay controls style="width:50%;height:50%;"></video>
But not working.
What to i do?
My Answer:
You cannot directly play a video file located on the hard disk using a file path in a web browser due to security restrictions. Instead, you should move the video file to a directory within your web server's document root and use a relative path to access it.
Here's an example of how you can modify your code to play a video file located within your web server's document root:
php
$src = "videos/Fle.mp4"; // Assuming the video file is located in a 'videos' directory within your document root
?>
Make sure to move the video file to the specified directory within your document root and adjust the file path accordingly. This should allow you to play the video file successfully.
Rate this post
4 of 5 based on 8361 votesComments