BODY OF THE BOOK - Part C

A WORD ABOUT AUDIO CONTENT

   You can also insert audio in an ebook, just as you would on a website. The top two choices are MP3 files or, again, Flash files. The MP3 is very common and most people are familiar with it; Flash - while playable on most all computers and operating systems - is harder to program on your end. An MP3 file can run pretty large, too, so you might want to keep them short or break them into smaller files. Depending on how do your HTML coding on your web page, it may or may not play in all browsers (Internet Explorer, Netscape, Firefox, AOL, etc.).

   Here are two methods that will work, with somewhat varying results. The first will, in some browsers, open the music in a new window. The second method is the simplest and works with Firefox/Netscape as well as Internet Explorer. It is also the simplest: just click the link.

METHOD A

METHOD B
Listen to "Morning Breeze I" by Anugama from "Caveman - Before the World" album!

   NOTE: The audio content on this page is quite large - the page would take 2,465 seconds to load over a dial-up connection of 56Kb per second (89 seconds over a T1 fast connection).

    So how do I make it work? Just copy the code below and replace the filename and link text (in bold) with your own MP3 file (Just remember to paste it into NotePad first!).

<a href="sound/64357-Anugama-Morning Breeze I.mp3"><b>
<font face=
"Arial">
Listen to "Morning Breeze I" by Anugama from "Caveman - Before the World" album!
</font></b></a>

   So what if I want to play several sound files, like an album? Go into Windows Media Player (WMP) and load the songs you want, then create a WPL playlist and copy it to your ebook folder. Your link, instead of looking like the one above, will look like the one below. Having WMP open in another window can be a distraction from the content of your ebook - so there has to be a better way, right? Stay tuned for my next ebook on the subject.

<a href="sound/Caveman-Before the World.wpl"><b>
<font face=
"Arial">
Listen to the album "Caveman - Before the World" by Anugama.
</font></b></a>

Listen to the album by Anugama - Windows Media Player (WMP)
This will open up WMP in its own window. It has only two songs to keep the size smaller.

   Maybe you dislike Flash; maybe you just want to know what the alternatives are. Well, there's another approach - supported by other players such as Windows Media Player, RealPlayer and QuickTime Player. But be warned: it's limited, and there's no way to go beyond it. Want to display the current song title, for instance? You can't reliably do that across all browsers and platforms. So I strongly recommend you use the XSPF Web Music Player method instead.

   Understood? OK, here's the alternative method. Just follow these steps to create an MP3 playlist and convince Windows, MacOS X, and Linux browsers to play the songs in sequence, in the background, for as long as your page is displayed or until the end of the last song, repeating if desired. See the end of this entry for technical notes... and be sure to read them first if you think you've spotted a mistake on my part!

Step One. Upload the MP3 files to your web site. I'll assume your site is called www.example.com and the files are in a folder called example with the names a.mp3, b.mp3, c.mp3 and d.mp3.

Step Two. With plain old Windows Notepad or any other text editor, create a new text file called playlist.m3u. Place the following lines in the file:

http://www.example.com/example/a.mp3
http://www.example.com/example/b.mp3
http://www.example.com/example/c.mp3
http://www.example.com/example/d.mp3

Step Three. Save the playlist.m3u file and upload it to the example folder of your web site, www.example.com.

   Insert the embed element anywhere inside the body element of your page. If you choose to make the player visible, place the embed element at an appropriate location within the page. Step Four. Use the <embed> element to insert an audio player in your web page, like this. The <embed> element should appear in the <body> element of the page. You can make the player invisible by setting the width and height attributes to zero, but you don't have to. You do have to leave the type attribute set to audio/mpeg or this technique will not work in Firefox for Windows, which is now a very common browser:

<embed src="http://www.example.com/example/playlist.m3u"
  autostart="true"
  type="audio/mpeg"
  loop="true"/>

   Your .m3u file can be on any web site. The src attribute of the embed element can contain any valid URL.

Step Five. Access your page. You should hear the four songs play in order and then repeat (because we set loop="true").

SOURCE: WWW FAQs How do I play a list of several MP3 songs on a web page