Automatically convert media links with jQuery

Apr 16, 2009 · Follow on Twitter and Mastodon javascriptjqueryweb

This post will show you how to automatically convert media links with jQuery, for instance audio links to a Flash-based audio player.

I’m currently building a PHP-based framework that can be used to create web sites with a database and PHP classes that auto-generate corresponding JavaScript types that trigger the same functionality in an asynchronous way. It also comes with a CMS that lets you add pages with text, images, links and any data you like.

As I now use this framework to create a personal web site, which contains a bunch of links to MP3 files and YouTube clips, I want to let visitors play this content directly from the web site. I therefore want to convert these links to proper media players, depending on the content type.

Imagine my excitement, when I found a jQuery Flash and Media plugins, that convert “a” tags that refer to MP3 files or YouTube clips to a music/video player! I use it to automatically convert any a tag that uses the media class to the proper media player, based on the media type.

The Flash plugin has been discontinued, but the jQuery media plugin is still up:

http://malsup.com/jquery/media

Discussions & More

Please share any ideas, feedback or comments you may have in the Disqus section below, or by replying on Twitter or Mastodon..

If you found this text interesting, make sure to follow me on Twitter and Mastodon for more content like this, and to be notified when new content is published.

If you like & want to support my work, please consider sponsoring me on GitHub Sponsors.