Make Your Website Talk: How To Install Streaming Audio On Your Site

 

 Make Your Website Talk: How To Install Streaming Audio On Your Site


You’re ready to add a new feature to your website, but you want the users of your page to experience it in an interactive and engaging way. What do you do? Record a voice message for them! And then what? Well, if you just add that file to your web server, then visitors will hear the recording whenever they visit your page. But if you want it so that people can listen as they browse through any web page on your site—even those with static content—then you’ll need a streaming audio player script.

If you’ve followed my advice on creating WordPress themes in the past, then you’ve learned how to install scripts using your theme’s functions.php file. But if you try and install a script through your theme, then you’ll also need to include the link for that script on every page of your site (including home pages, pages with static content, etc.) because some of those scripts can overwrite files in the website root directory. That makes it hard to add new features to your site that require streaming audio.

Fortunately, you can install streaming audio players without using your theme’s functions.php file. The only catch is that you need to include the script’s source files in every page of your website. But don’t worry: there are lots of scripts that will let you do this easily without building a ton of extra links into every page.

This article shows you how to install streaming audio through the Pippin Maddox Streaming Audio Player—a lightweight script that lets users play audio from any part of your site, even if it has static content on it. I’ll also show how to use an alternative script, the WPFAudioStreaming plugin . This plugin offers a large number of huge improvements to the Pippin Maddox script. You can read about all of the things it does in this article: "The Ultimate Guide to: WPFAudioStreaming".

INSTALLING THE PIPPIN MADDOX STREAMING AUDIO PLAYER SCRIPT

You can install both the Pippin Maddox and WPFAudioStreaming scripts through your theme’s functions.php file if you want, but there’s no reason you need to. You can easily install them through just one little line of code that you add to every page of your site.

To do this, all you need to do is create a PHP block in your site-wide functions.php file that looks something like this:

<?php get_header(); ?> <?php if ( function_exists('maddox-util') ){ echo '<script type="text/javascript" src="' . maddox-util() . '">'; ?> <?php echo maddox-util(); ?> </script> <?php }else{ ?> <p><center><br/></center></p> <?php } ?>

That code will install the Pippin Maddox script on your server with a one-line method call. Put this code block inside the existing <body> tags in your site’s functions.php file:

<?php get_header(); ?> <?php if ( function_exists('maddox-util') ){ echo '<script type="text/javascript" src="' . maddox-util() . '">'; ?> <?php echo maddox-util(); ?> </script> <?php } else { ?> <p><center><br/></center></p> <?php } ?>

The only thing you need to change in this code is the path to your HTML header file.

Conclusion: Once you’ve added this code to the footer of every page in your website, you’re ready to go. Repeat that process for any other streaming audio scripts that you want to add to your website.

Adding text content to your installation script: Many of the features of the Pippin Maddox script require that you include extra text content on your site. The easiest way to do this is to add it as a single line of code in the above installation script block.

Post a Comment

About