I am trying to recreate the following with Jquery
<video width="640" height="264" autoplay>
<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4" />
<source src="http://video-js.zencoder.com/oceans-clip.webm" type="video/webm" />
<source src="http://video-js.zencoder.com/oceans-clip.ogv" type="video/ogg" />
</video>
I have come up with the following but in IE9 the video element is empty, can anyone tell me why and what I would need to change to be able to dynamically add videos in IE9? It works fine in Firefox, Chrome and Safari.
HTML
<div id="videoHolder">
</div>
JQuery
var video = $('<video width="640" height="264" autoplay></video>')
.append('<source src="http://video-js.zencoder.com/oceans-clip.mp4" type="video/mp4" />')
.append('<source src="http://video-js.zencoder.com/oceans-clip.webm" type="video/webm" />')
.append('<source src="http://video-js.zencoder.com/oceans-clip.ogv" type="video/ogg" />')
.appendTo($("#videoHolder"));
UPDATED – closed the video tag above and addded new link
Try the following, this works:
JSFIDDLE example.
What I did to get this working was:
htmlmethod to inject the desired mark-up all at oncevideoandsource) to use full closing tags as opposed to shorthand/>A rather cool video, by the way.