David
David

Reputation: 184

Video working in Chrome but not Firefox

I can get videos to play in Chrome with the embed tags towards the bottom of the page, I have them commented out. Anyway, it doesn't work for Firefox and I can't find another way to get it to display and play my video from the database.

Within the div tag, myElement, if I type the location of the video on my computer, it'll load right up, but I'm wanting to get the video off my db by $url and every time I try, it says 'A plugin is needed to display this content or No video found.'

I've also tried using <video>, didn't seem to 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>

Solution

Instead of :

echo "<embed src='$url' width='560' height='315'></embed>";

Use this :

echo "<video controls src='$url' width='560' height='315'></video>";

Upvotes: 3

Views: 1010

Answers (2)

David
David

Reputation: 184

After HOURS & a few days of trying to find out my problem, I was messing around with the video tags and BOOM! echo "<video controls src='$url' width='560' height='315'></video>"; If you're having my pain of 'A plugin is needed to display to content' or 'Format or MIME type not supported' try this out! $url is what I'm using to retrieve the video from my database so that's the location of the file just incase anyone wanted or needed to know. BTW I was using the video tags as HTML5 and it wasn't working so I switched it and now it's working like a champ

Upvotes: 1

Ben Chamberlin
Ben Chamberlin

Reputation: 731

(Source: http://www.w3schools.com/html/html5_video.asp)

The video you're testing might be a format that's supported by Chrome but not Firefox. Generally you wind up needing to provide sources for multiple formats just to be safe (example from 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>

Upvotes: 0

Related Questions