Quickie.js - MooTools wrapper for QuickTime

Quickie.js is a small (4kb) MooTools class too embed QuickTime elements into your website. It is based on the Swiff.js class provided by MooTools so if you’re familiar with that class, you’ll find yourself at home with this one.

Features:

  • Written in MooTools. Requires version 1.2.1+
  • Automatically inserts browser-appropriate code for the QuickTime movie.
  • Allows you to listen for the DOM events QuickTime fires using familiar MooTools listeners.

Usage:

Here’s how you can use Quickie.js to quickly embed QuickTime movies into your pages:

  1. Download Quickie.js from the right, extract the files and copy the quickiejs directory into a web-accessible directory of your choice.
  2. Link to the Quickie.yui.js file in the head section of your document after the MooTools link. The example below assumes you extracted the files to a folder called “js”.
    <head>
    ...
    <script type="text/javascript" src="js/mootools.core.js"></script>
    <script type="text/javascript" src="js/Quickie.yui.js"></script>
    ...
    </head>
  3. Add the following IE conditional code to the head section of your document. This object is necessary for IE to fire the QuickTime DOM events as detailed in the JavaScript Scripting Guide for QuickTime.
    <head>
    ...
    
    ...
    </head>
  4. Finally, use the following JavaScript code example inside of a ‘domready’ or ‘onLoad’ function to create the Quickie object.
    var myQuickie = new Quickie('myMovie.mov', {
    	id: 'myQuicktimeMovie',
    	width: 640,
    	height: 480,
    	container: 'qtmovie',
    	attributes: {
    	  controller: 'true',
    	  autoplay: 'false'
    	},
    	onPlay: function() { alert('Playing'); },
    	onPause: function() { alert('Pausing'); }
    });

Options:

  • id – (string, defaults to Quickie_uniqueid) Id for the element which will be used to reference the QuickTime movie.
  • width – (integer, defaults to 1) Width of the movie in pixels.
  • height – (integer, defaults to 1) Height of the movie in pixels.
  • container – (string) ID of the element where the QuickTime movie will be inserted. Note anything inside the container will be wiped out.
  • attributes – (object) Key/Value pairs of any of the attributes a QuickTime movie can receive. There are two defaults, controller is set to true and postdomevents is set to true as well.

Events:

Quickie.js can attach listeners to any of the QuickTime DOM Events. To add an event, simply add another property in the options object which begins with ‘on’ followed by the name of the event you want to listen for with the first letter capitalized. No need to use the ‘qt_’ prefix. For example, to listen for the play event, you would add this to the options object:

onPlay: function() { alert('qt_play fired'); }

Known Issues:

IE is very picky with QuickTime events so there are some circumstances where it behaves wonkily, particularly with initialization events. I’m working on taming IE, but at the very least the major events (play, pause, etc) behave reliably.

Compatibility:

So far, I’ve only been able to test Quickie.js in the following browsers. Should work in others, will list them here pending confirmation.

  • Safari 4
  • Internet Explorer 7
  • Firefox 3

License:

Quickie.js is licensed under the MIT License. Use it, modify it, have fun with it… in any circumstance.


  • This is a fantastic script, but I'm getting the following error in IE7 and IE8...

    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729)
    Timestamp: Thu, 4 Mar 2010 10:08:31 UTC


    Message: Unspecified error.
    Line: 107
    Char: 4
    Code: 0
    URI: http://www.eco-3.co.uk/js/Quickie.js

    Ironically it errors out during the first line of the "ieFix" function. Also the demo on the MediaBoxAdvanced homepage shows this error.

    Any advice you can offer would be greatly appreciated.
  • metaskills
    Good stuff! I saw this script used on the Convertbot iPhone application from Tapbots and wrote up a version using Prototype. Link here http://metaskills.net/2010/1/25/quickie-js-prot...
  • Tomas
    For some reason it clashes with Firebug:

    [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIStreamListener.onStopRequest]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///Users/[mac_username]/Library/Application%20Support/Firefox/Profiles/hmdx1nm6.default/extensions/firebug@software.joehewitt.com/components/firebug-channel-listener.js :: anonymous :: line 167" data: no]
    file:///Users/[mac_username]/Library/Application%20Support/Firefox/Profiles/hmdx1nm6.default/extensions/firebug@software.joehewitt.com/components/firebug-channel-listener.js
    Line 167
  • Tomas
    To further help, this only happens if the resource (.mov) is not found. If the source is found the error does not occur.
  • Hey Tomas, what browser/OS are you using and what code caused the error?
  • Tomas
    It must have been an error with Firebug because it does not seem to happen anymore with the latest update. It was on Mac OS X 10.6 + Firefox + Firebug 1.4.*
blog comments powered by Disqus