Integrating Technology in the Second Language Classroom

  
Jean LeLoup & Bob Ponterio 
SUNY Cortland 
© 2017
  Embedding a sound in a web page


So far, we have seen that you could have added sound to a web page simply by setting up a link to the sound in much the same way that we make a link to another web page. When we do this, we have no control over how a user's web browser will play the sound. It might open an external application, such as Media Player or WinAmp or play the sound within a new browser window (if it works at all). If the sound is part of a lesson, there might be text, vocabulary support, interactive questions, images, or other pedagogical materials that you want the student to be able to see while the audio is playing. So you may need to have more control over how the sound is played and where it is located in your lesson. Try this song link to see how such a simple link works on your computer with your browser settings.

A better option is to embed the audio right into the web page where the text or activities are located, thus integrating the audio within the language lesson. We do this by placing an object on the page, and this object acts as an audio player to play our sound. We will look at several different ways to do this. (You can download this practice page and the song to practice.)

HTML5 <audio> tag.

Recent updates to web page design call for a simple audio object that will work with current web browsers. The <audio> tag uses your browser's built-in audio player. This is the format we generally recommend using. It is easy, but it gives you limited control of the appearance of the audio object.

You will need to place the code for the audio object into the Source code for your web page. The following code places an object on the page to play the song "maquillaje.mp3". If the code does not work in the user's browser, an error message will display.

<audio controls>
<source src="maquillaje.mp3" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>

In KompoZer, you may need to write the source code this way to prevent errors:

<audio controls>
<source src="maquillaje.mp3" type="audio/mpeg"></source>
Your browser does not support the audio tag.
</audio>

You can copy this code and use it in your own pages, but be sure to change the sound file name to match your own sounds. The width of the HTML5 <audio> object can also be controlled by specifying its size in pixels:

<audio controls style="width:38px">

<audio controls style="width:200px">

The following two articles explore how all this works:

Native Audio in the browser: http://html5doctor.com/native-audio-in-the-browser/

HTML5 Audio — The State of Play: http://html5doctor.com/html5-audio-the-state-of-play/


 

Yet Another Way - MP3 Player using Flash:

This flash based player looks nicer than the default HTML5 player, but it is more limited in where it will work. The player itself is located on your web site and is downloaded with your web page, solving come, but not all, compatibility issues. However, using it is quite a bit more complicated than HTML5.

http://flash-mp3-player.net/players/maxi/

Go to the site and download the mp3player file: player_mp3_maxi.swf

Put this file in your web site folder and point to it in your sound object. I will put it in its own folder, called mp3player, just to make it easier to find and also easier to point to.

Here is the Object Code that you would copy and paste into your web page Source Code. Note how data="mp3player/player_mp3_maxi.swf" points to the player that we downloaded and put in its own folder. The mp3 sound file name is in red in our example below; you would substitute your own sound file name.

<object type="application/x-shockwave-flash" data="mp3player/player_mp3_maxi.swf" width="200" height="20">
<param name="movie" value="mp3player/player_mp3_maxi.swf" />
<param name="FlashVars" value="mp3=maquillaje.mp3&showstop=1&showvolume=1&bgcolor1=97B3D6&bgcolor2=085c68&volume=100&width=200&height=20" />
</object>

You can also shorten the width of the Flash Player to make a small "play" button with limited control.

Listen to this song by Mecano.

Although this is usually a good solution, fairly easy and giving you good control over the appearance of the object, I still recommend the HTML5 solution for your projects because there are fewer things that can go wrong.

Here are some other players that use HTML5 but improve on its functionality.

https://code.tutsplus.com/tutorials/15-best-html5-audio-players--cms-28796

http://www.catswhocode.com/blog/10-awesome-html5-audio-players



Return to Syllabus