Video works in Chrome but not Firefox
I can get videos to play in Chrome using embed tags at the bottom of the page and I have commented them out. Anyway, it doesn't work for Firefox and I can't find any other way to get it to display and play my video from the database.
In the div tag myElement
, if I type in the location of the video on my computer, it will load correctly, but I want the video to disconnect from my db on $url
and every time I try, it says "Plugin is required to display this content or video not found" ...
I also tried to use <video>
, didn't work either.
<!DOCTYPE html>
<html lang="en">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Watch</title>
<script src="http://jwpsrv.com/library/6QVxzPkvEeSkJwp+lcGdIw.js"></script>
<script src="jwplayer/jwplayer.js" ></script>
<script>jwplayer.key="7SYdCOHxpEaICfiAz4rXDkkgf+fcssszRYDb2Q==";</script>
</head>
<body>
<div id="myElement">Loading the player...</div>
<script type="text/javascript">
jwplayer("myElement").setup({
file : "<?php ?>",
//image: "",
width: 640,
height: 360
});
</script>
<?php
if(isset($_GET['id']))
{
$id = $_GET['id'];
$query = mysql_query("SELECT * FROM `videos` WHERE id='$id'");
while($row = mysql_fetch_assoc($query))
{
$name = $row['name'];
$url = $row['url'];
}
echo "Your are watching ".$name."<br />";
//echo "<embed src='$url' width='560' height='315'></embed>";
}
else
{
echo "Error!";
}
?>
</body>
</html>
Decision
Instead:
echo "<embed src='$url' width='560' height='315'></embed>";
Use this:
echo "<video controls src='$url' width='560' height='315'></video>";
source to share
After HOURS and a few days trying to figure out my problem, I fiddled with video tags and BOOM! echo "<video controls src='$url' width='560' height='315'></video>";
If "Plugin is required to display content" or "Format or MIME type is not supported" hurts, try this! $ url is what I use to fetch videos from my database so that the file location just hovers on whatever I want or need. BTW I used video tags like HTML5 and it didn't work, so I switched it over and now it works like a champion
source to share
(Source: http://www.w3schools.com/html/html5_video.asp )
The video you are testing may be in a format supported by Chrome, but not Firefox. Typically, you need to provide sources for multiple formats to be safe (example from the W3C link above):
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
Your browser does not support the video tag.
</video>
source to share