Hi Guys,
Anybody tell or give me the code for show and play video in PHP.
Reply as soon as possible.....
Hi Guys,
Anybody tell or give me the code for show and play video in PHP.
Reply as soon as possible.....
Short answer: PHP runs on the server and does not "play" video in the browser. It generates HTML (or streams bytes) so the browser or a JS/HTML player does the actual playback. was right to point out the distinction, and 's Flash-player suggestion was common in 2010 — today prefer the HTML5 video element or a modern JS player for consistent behavior across devices.
A simple, modern embed (put this in the page PHP outputs):
<video controls width="640" poster="thumb.jpg">
<source src="/videos/movie.mp4" type="video/mp4">
<source src="/videos/movie.webm" type="video/webm">
Your browser does not support the video tag.
</video> If you need to choose files dynamically from PHP, generate the markup server-side but validate input (whitelist filenames, use basename(), escape output). Example pattern:
<?php
$file = basename($_GET['file']); // validate against an allow-list in real code
$url = '/videos/' . $file;
echo '<video controls poster="thumb.jpg">';
echo '<source src="'.htmlspecialchars($url, ENT_QUOTES).'" type="video/mp4">';
echo '</video>';
?> Practical notes and troubleshooting:
video element (MDN) and PHP file-serving functions (HTML5 video element, readfile() / headers).Jump to Post— vibhaJ 126This one is very good player to integrate.
Try this out.
This one is very good player to integrate.
Try this out.
You can not play videos with PHP, You have to use flv player or other video players. OK!
can you please give me some idea or code kind of thing how to i do this
Hi shailendra,
download flv player from :
Now You will get one readme.html file.
Here you will find embeded code to play file.
and you will find file=video.flv , video.flv is file to play.
Now all you need is to dynamically add ur file here using php tag.
e.g. <param name="flashvars" value="file=<?=$myfile;?>&image=preview.jpg" />
Now copy all files which are used in demo and insert in your website's directory structure to work it out.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.