Reputation: 1703
Hello guys im struggling with displaying gif image in mp4 format:
<video width="320" height="240" >
<source src="http://media4.giphy.com//media//64zSh1uTE7xxm//100w.mp4" type="video/mp4"/>
</video>
that's my code, but only first frame is beeing loaded, then everything freezes. // edit I have remade it into this:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1"/>
<title>Insert title here</title>
</head>
<body>
<video width="320" height="240" >
<source src="http://media4.giphy.com//media//64zSh1uTE7xxm//100w.mp4" type="video/mp4" autoplay/>
</video>
</body>
</html>
but still its static image.
edit2// I'have added
controls="controls"
since In XHTML, attribute minimization is forbidden, and the autoplay attribute must be defined as video autoplay="autoplay".
Upvotes: 3
Views: 4753
Reputation: 1
Add the autoplay property to the video tag, e.g.:
<video width="320" height="240" autoplay>
Upvotes: 0
Reputation: 4187
You need to play the video, too, because by default it will pause at 0:00. There are 3 possible solutions to this problem.
controls
attribute (<video ... controls>
) to show the
controls and play it manuallyautoplay
attribute (<video ... autoplay>
) to
autmatically play the video once it has loadedGet the element via JavaScript and play it there (same behaviour as autoplay in this solution):
var video = document.getElementById ("videoElement");
video.addEventListener ("loadedmetadata", function () { video.play (); });
For further information on HTML5-Video attributes, check out MDN: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video
Upvotes: 3
Reputation: 260
You forgot the full construction.
<video width="320" height="240" controls> </video>
instead of controls you can use other attributes.
For more informations go to: w3schools
Upvotes: 0
Reputation: 1325
I'm not too proficient in HTML myself, but I've experienced this problem too. The reason why the video is frozen on the first frame is because, by default, the video is paused at 0:00, which means it will simply not play without user intervention or code to play itself. There are two solutions to this:
<video width="320" height="240">
to <video width="320" height="240" controls>
orautoplay
attribute, which can be done by again changing <video width="320" height="240">
to <video width="320" height="240" autoplay>
.Hope this helped!
Upvotes: 2