jQuery insert quicktime video player

jQuery demo + code snippet to insert a quicktime video player into your webpage dynamically. This is a raw video play with minimal controls, if you want to customise you can set the parameters in the player object quite easily. To use the code remember to change the url of the video and you’ll need a div with id=”player”. In my demo I included a screenshot of the video to use as a thumbnail but quite easily just be a hyperlink with id=”start-movie-btn”, these can be changed accordingly.

Demo

Note: You will need quicktime installed to play the movie.
piper-horse

The Code

//dynamically load in a movie using Quicktime player
(function($,W,D)
{
    var JQUERY4U = {};

    JQUERY4U.QUICKTIME =
    {
        play: function(movieUrl)
        {
            //quicktime video html
            var output = '<object width="640" height="360" id="qt" classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" style="float:left; left:0; position:relative; top:0;">';
            output += '<param name="src" value="'+movieUrl+'">';
            output += '<param name="autoplay" value="true">';
            output += '<param name="controller" value="false">';
            output += '<embed id="player" name="player" src="'+movieUrl+'" bgcolor="000000" width="640" height="360" scale="ASPECT" qtsrc="'+movieUrl+'"  kioskmode="true" showlogo=false" autoplay="true" controller="true" pluginspage="http://www.apple.com/quicktime/download/">';
            output += '</embed></object>';

            //insert the player
            jQuery('#player').html(output);
        }
    }

    $(D).ready(function($)
    {
        $('#start-movie-btn').live('click', function(e)
        {
            e.preventDefault();
            JQUERY4U.QUICKTIME.play('location of movie'); //.mov .mp4 etc
        });
    });

})(jQuery, window, document);

Movie source: http://www.youtube.com/watch?v=jAqvcdiAgAA