30 - Hooking up the Wimpy Player in ExpressionEngine
The Flash-based Wimpy Player is a slick, simple way to let web site visitors listen to .MP3 files right on your website. In this chapter I’ll cover how to implement it within ExpressionEngine as a way to let visitors to the church site listen to the audio messages.
While Wimpy has extended their product offering to more advanced and feature-rich media players, I like the simplicity of the simple Play button. Getting it hooked up to the existing ExpressionEngine-based implementation of the Church site audio section is really straightforward. Here’s the overall process:
- Download the Wimpy Player
- Upload Wimpy files to your webserver
- Use the Wimpy site to generate sample HTML
- Make the HTML Reusable
- Update EE templates
Download the Wimpy Player
You can download Wimpy Player button here (and yes, that is an affiliate link - if you end up buying the a Wimpy product you can help support Train-ee by using it). Note that the download will time out after 15 days if you don’t purchase the button.
Upload the Wimpy Files to Your Webserver
After unzipping the Wimpy archive locally, there are three files that will need to be loaded to the webserver: wimpy_button.swf, wimpy_button.js, and example.mp3. I can put these wherever I want on my webserver, as in a following step I’ll create HTML that will contain the paths to these files. I have separate folders for swf, js, and audio files so chose to split the thee files up by file type. Another way would be to keep them together in a /wimpy folder.
Use the Wimpy Online Customizer to Generate Sample HTML
With the files now in place I need some HTML. I used Wimpy’s Online Customizer to generate some starter HTML to work with. The Customizer lets you specify the paths to the files and the size/background color of the play button. You can test your paths to make sure everything works before generating the HTML.
Once I verified my paths were correct and chose the appearance of my button, Wimpy Generated this Code:
<!-- Wimpy Button Code -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" width="50" height="50" id="wimpy_button_97019" name="wimpy_button_97019" >
<param name="movie" value="http://church.train-ee.com/swf/wimpy_button.swf?theFile=http://church.train-ee.com/audio_files/example.mp3&wimpyReg=NXMlNUJBJTdDdiU3Q3NzJTdGSyU4MVhJSGwlMjglM0QlNUMlN0ZsS3Jla1glNUNiY1lw " />
<param name="quality" value="high" />
<param name="bgcolor" value="#6A7A95" />
<embed src="http://church.train-ee.com/swf/wimpy_button.swf?theFile=http://church.train-ee.com/audio_files/example.mp3&wimpyReg=NXMlNUJBJTdDdiU3Q3NzJTdGSyU4MVhJSGwlMjglM0QlNUMlN0ZsS3Jla1glNUNiY1lw " width="30" height="30" quality="high" bgcolor="#6A7A95" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="wimpy_button_97019" /></object>
<!-- End Wimpy Button Code -->
Note that I purchased the button, so was able to also enter the registration code. If you’re just evaluating the button you won’t need to do that until you actually buy it.
If you paste that code to a template on your site and render it, you should get a Play button that when clicked plays the example.mp3 audio file. This is great - except that the file name of the mp3 file tp play is hardcoded. I’ll have multiple .mp3 files that I need to play and the file names will be stored in a weblog post in ExpressionEngine. What to do?
(Insert long pause here….in hopes that an idea will come to you before I suggest it….)
Making the HTML Reusable
In ExpressionEngine, anytime you are in a situation where most of a chunk of code will work all the time but a few parts of it need to change each time you should look to an Embedded Template with an Embed Variable. Creating an Embedded Template from this code means it only gets stored once within EE, and by making the file name portion of the code an Embed Variables means I can “pass in” the file name I want the player to be connected to.
So I created a new embedded template named embeds/wimpy-button and pasted in the HTML that the Wimpy Online Customizer generated. I then edited the HTML and replaced the hardcoded “example.mp3” references with:
{embed:the-audio-file}
There is one other thing I need to accommodate with an embed variable. According to the Wimpy Docs, if I have multiple buttons on one page, they each need a unique name and ID. Since I’ll be pulling the Wimpy code in within a EE weblog:entries tag, I’ll have the entry_id variable that will be unique for each post within the audio-messages weblog, and can pass that into embeds/wimpy-player to create a unique name and ID each time. So I edited the Wimpy HTML to replace all “wimpy_button_97019” references with:
wimpy_button_{embed:the-entry-id}
Here then is my final version of embeds/wimpy-button:
<!-- Wimpy Button Code -->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,47,0" width="50" height="50" id="wimpy_button_{embed:the-entry-id}" name="wimpy_button_{embed:the-entry-id}" >
<param name="movie" value="http://church.train-ee.com/swf/wimpy_button.swf?theFile=http://church.train-ee.com/audio_files/{embed:the-audio-file}&wimpyReg=NXMlNUJBJTdDdiU3Q3NzJTdGSyU4MVhJSGwlMjglM0QlNUMlN0ZsS3Jla1glNUNiY1lw " />
<param name="quality" value="high" />
<param name="bgcolor" value="#50090D" />
<embed src="http://church.train-ee.com/swf/wimpy_button.swf?theFile=http://church.train-ee.com/audio_files/{embed:the-audio-file}&wimpyReg=NXMlNUJBJTdDdiU3Q3NzJTdGSyU4MVhJSGwlMjglM0QlNUMlN0ZsS3Jla1glNUNiY1lw " width="30" height="30" quality="high" bgcolor="#50090D" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="wimpy_button_{embed:the-entry-id}" /></object>
<!-- End Wimpy Button Code -->
Update EE Templates
All that’s left (besides some CSS work that I won’t cover here but will just include in an updated stylesheet) is to update audio-messages/index and audio-messages/comments to now call embeds/wimpy-button and pass in the two necessary variables.
Here’s the code I added (note this is within the weblog:entries loop):
<div class="wimpy_player_right redBorder">
<h5>Play this Message</h5>
{embed="embeds/wimpy-button the-audio-file="{audio_file}" the-entry-id="{entry_id}"}}
</div>
The Results
You can view the finished product on my example church site. I’m just using short example mp3’s for simplicity but you’ll get the overall idea. Now that I look at the page if this were a client site I’d probably go back and add a “length” field to the audio-messages weblog so people would know how much time they’d need to listen to the whole message.
Next up I’ll cover creating an actual Podcast feed that will allow more tech-savvy visitors the ability subscribe to the church messages, and download new ones them automatically.
Note/Update: A reader in the EE forums noted that Wimpy offers a plug-in designed for ExpressionEngine - if you’ve used that I’d like to hear about it.
Category Navigation







by Kevin
Date: Wednesday, December 10th, 2008
Comment: #1
Mike,
I don’t know about you, but up in Canada we now KNOW it’s officially winter .... 6.8F (-14C) is our average for the next week. Doh!
Thanks for spending a few weeks on the media/audio portions of a site. If anything, this would be CONSISTENT weekly content that the visitor would know would be NEW and not STATIC/dead!
One thing that I really wonder is WHAT exactly would our visitors search for on our site, and build search around THAT! Regarding online media/audio, the way you are building the site, are you able to sort/search by Scripture passage (something that might be very useful when you get a larger library)? Could you sort by speaker (or will this come up with “relationships” in the future)?
Thanks for putting so much thought into this series. Once I saw Sean Sperte’s EE audio ideas (http://tinyurl.com/eesermonaudio) I really got excited when you got to this section, and wanted to see your approach! Looking forward to the next episode!
Kevin