JavaScript
Article
By Sam Deering

jQuery insert quicktime video player

By Sam Deering
Help us help you! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

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.

--ADVERTISEMENT--

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 = '';
            output += '';
            output += '';
            output += '';
            output += '';
            output += '';

            //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

Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the most important and interesting stories in tech. Straight to your inbox, daily.Is it good?