I made an official release for the jQuery Media module. This is a wrapper for the jQuery Media plugin. I have made this a full featured module, an aid for developers and themers. We are using it for the audio clips of Air America Radio.
From its help page:
The jQuery Media plugin will turn links to media into their embedded media equivalents, or into a modal overlay embedding the media when the link is clicked. Installing and configuring the module is only the first step: you must also manually theme the output of links in order to enjoy the benefits of this plugin.
Theming is outside of the scope of this help page. You might look at Drupal’s Theme Developer’s Guide for more information. However, once you are ready to theme your elements, you only need to add a class and invoke this plugin. For instance, if you have a File Field with a video, simply use something like the following: <?php
jq_add(‘jquery_media’);
print l($node->title, $node->field_file_field[0][‘filepath’], array(‘class’ => ‘media’));
?>
You may override the global defaults of this plugin when configuring. Additionally, you may override a global default on a case-by-case basis by including the override in an options array when invoking the plugin. For instance, you might override the background color of players on a specific page with <?php
jq_add(‘jquery_media’, array(‘bgcolor’ => ‘#33FF00’));
?>
This will override the defaults of the plugin for every media link on that page, which may in turn override those individually (more on that later).
The full array of global overrides are as follows:
- ‘flvplayer’ => The path to the Flash Video Player to be used, such as the JW FLV Player or Wimpy Rave.
- ‘mp3player’ => The path to the MP3 Audio Player to be used, such as the JW FLV Player or Wimpy MP3 Player.
- ‘boxtitle’ => When using the MediaBox option (the modal overlay), this will be the title displayed on that box after clicking the link.
- ‘loadingimage’ => When using the MediaBox option, the path to this image will be displayed while loading the media after clicking the link.
- ‘media width’ => The width the media will be displayed as.
- ‘media height’ => The height the media will be displayed as.
- ‘mediabox width’ => The width the MediaBox will be displayed as.
- ‘mediabox height’ => The height the MediaBox will be displayed as.
- ‘autoplay’ => If TRUE, then play the media as soon as loading it.
- ‘bgcolor’ => This will be the background color for the media player, in hexidecimal code (#RRGGBB).
- ‘invoke media’ => If TRUE, then cause all links with the ‘media class’ to automatically be turned into embedded media when invoking the plugin.
- ‘invoke mediabox’ => If TRUE, then cause all links with the ‘mediabox class’ to automatically display a modal overlay box when clicked.
- ‘media class’ => The class that will be turned into embedded media on invocation. It uses jQuery CSS notation, so should be something like ‘a.media’ for links.
- ‘mediabox class’ => The class that will display a modal overlay box when clicked on invocation. It uses jQuery CSS notation, so should be something like ‘a.mediabox’ for links.
Finally, you may override a global setting on an individual basis. The customizations here are extensive, and rather than repeating that here, you are directed to the jQuery Media homepage for more information. As an example, you might set the size of a specific file with the following, while leaving any other jquery media links on the page at their default. (Note that we change the class away from the default ‘media’ in this example. It also assumes we’ve already invoked it as above.): <?php
print l($node->title, $node->field_audio_file, array(‘class’ => ‘media-audio’)); drupal_add_js(“$(‘a.media-audio’).media( { width: 200, height: 15, autoplay: true } )”, ‘inline’);
?>
Note that by default, the module will add its default overrides inline. However, you may set it to output them to a dynamic javascript file, and may additionally wish to set the defaults to a static js file, once development is complete. You can alter those settings when configuring the module.