I am trying to make a plugin for displayng html5 video as follows:
(function ($) {
// plugin definition
$.fn.myvideo = function (options) {
// build main options before element iteration
var defaults = {
theme: 'normal',
};
var options = $.extend(defaults, options);
// iterate and reformat each matched element
return this.each(function () {
var $myvideo = $(this);
addvideo();
function addvideo() {
var addvideo = $('<video controls="controls" width="480" height="208" id="video2"><source src="http://devfiles.myopera.com/articles/2642/sintel-trailer.ogv" type="video/ogg; codecs="theora, vorbis""><source src="http://devfiles.myopera.com/articles/2642/sintel-trailer.mp4" type="video/mp4; codecs="avc1.42E01E, mp4a.40.2""></video>');
$(addvideo).append('body');
}
});
};
})(jQuery);
This is how I call it:
<script>
$(function () {
$('#video').htmlvideo();
});
</script>
This is a link to call the video:
<a href='#' id='video'><span>Launch video</span></a>
And it dosent display anyting :(
Can anyone say what the mistake is?
And how do I display the video without the link?