with Imagination: by Dustin Diaz

./with Imagination

A JavaScript, CSS, XHTML web log focusing on usability and accessibility by Dustin Diaz

Podcast entries have been ‘odeoized’

Saturday, April 15th, 2006

One final thing before I take off to Boston, I just wanted to mention that the podcasts on WSwI now have a flash player where you can play the audio files directly on the site. Granted this shouldn’t stop you from downloading them to your iPod to listen to them later, it’s just an alternative that allows you directly play them in a more convenient manner.

So, first thing’s first before I hear some of you cry “Now your webpage is not valid xhtml strict.” Well, I can live with that for now. I can no doubt use JavaScript to embed the markup into the page, but I’m too lazy for that right now.

Otherwise, I thought I’d share just a bit on how easy this was to integrate into Wordpress. If you haven’t noticed yet, Odeo is now offering (what I would like to call) “badge code.” What that means is that for every audio file that is picked up into your feed via Odeo, there is code provided for you that you can embed into your webpages.

Alright. Simple enough. What I did with that code is pasted it directly into my single.php file within your current theme directory and added a bit of logic to it. Oh right, and before I had even done that, I already had a particular category called “Podcasts.” That can be done simply by going into your wp-admin and clicking manage - > categories. Once that category has been added, it will have an id. Remember that id.

The next step is to open back up a podcast entry (a post) and add a custom “key/value” entry to that post. I called mine podcast_entry, then for the value I put the actual file name for the value (I didn’t bother putting the full path, but I could have).

Then finally, within my singe.php file I went ahead and put the following code in

odeo integration code for wordpress podcasters

<?php
// Wordpress Developers, pay special attention that this
// occurs within "THE LOOP"
if ( in_category(17) ): // 17 is my 'podcasts' category
	$podcast_url = get_post_meta($post->ID,'podcast_entry',true);
?>
<!-- insert flash player if podcast -->
<object
	classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
	codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0"
	width="476"
	height="80"
	align="middle">
	<param
		name="allowScriptAccess"
		value="any"
	/>
	<param
		name="movie"
		value="http://odeo.com/flash/audio_player_fullsize.swf?ver=1.03"
	/>
	<param
		name="wmode"
		value="transparent"
	/>
	<param
		name="flashvars"
		value="audio_id=999097&valid_sample_rate=true&external_url=http://www.dustindiaz.com/downloads/podcasts/<?php echo $podcast_url; ?>"
	/>
	<embed
		src="http://odeo.com/flash/audio_player_fullsize.swf?ver=1.03"
		width="476"
		height="80"
		allowScriptAccess="any"
		type="application/x-shockwave-flash"
		pluginspage="http://www.macromedia.com/go/getflashplayer"
		flashvars="audio_id=999097&valid_sample_rate=true&external_url=http://www.dustindiaz.com/downloads/podcasts/<?php echo $podcast_url; ?>"
		wmode="transparent">
	</embed>
</object>
<?php
endif;
?>

And with that, that’s all she wrote. It was that easy. I hope someone else finds this useful.

5 Responses to “Podcast entries have been ‘odeoized’”

  1. Jon

    I can no doubt use JavaScript to embed the markup into the page, but I’m too lazy for that right now

    so, hiding “invalid” code makes it valid? who cares if the code isn’t valid. does it work in all browsers? yep.

  2. Christophe

    When I have tu put flash content, I use the flashobject little library (http://blog.deconcept.com/flashobject/), which is very simple but very useful.
    And when I have tu put simple audio content like a podcast, I now use Dewplayer, free for use (http://www.estvideo.com/dew/index/2005/12/03/603-dewplayer-reloaded , in french, sorry).

    Maybe you could look at theese.

  3. Dustin Diaz

    Heh. I’m in Boston while I’m writing this.

    Anyway, the flashobject.js was definitely on my list of using first. But like I said, I was lazy. The Dew Player I haven’t seen before, but I’ll have to check it out. I used odeo’s player because I feel that I owe them dues for being nice and I generally like the work that they’re doing over there.

  4. Jason Beaird

    I’ll second the flashobject comment. I use it all the time and it actually makes embedding flash easier in my opinion. Hope you’re enjoyin’ it over here on the EASTSIDE!

  5. Brent

    Follow up:
    I have some links to these and the ufo examples at this url:
    http://www.wowtechminute.com/wow-tech-minute-transcript/activex-eolas-swfobject-ufo-alistapart.htm

    aloha

Leave a Reply

Phone Number:

If you're about to post code in your comment, please wrap your code with the tag-combo <pre><code>. Also please escape your html entities - otherwise they will be stripped out. I recommend using postable.

Get "JavaScript Design Patterns"

"As a web developer, you'll already know that JavaScript™ is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked--JavaScript is capable of full object-oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team."

Buy JS Design Patterns from Amazon.com Buy JS Design Patterns from Apress

Flickr

Submit a Prototype

All content copyright © 2003 - 2007 under the Creative Commons License. Wanna know something? Just ask.

About | Archives | Blog Search

[x] close

Loading...

Submit a prototype

By checking this prototype I agree that I am not submitting false credentials, pornography, or a hate crime website. I also understand that by submitting my entry I may or may not be accepted, and if accepted, my entry may be taken down at any given time if I violate these terms.