Page 2


This page is the same as Page 1, except that the audio player is "embedded". The user is able to play the sound without leaving the page.

Another change on this page is that the audio file is in a "protected" directory. The first time (during a browser session) that you try to access a file from the protected directory, you will be prompted to authenticate yourself with a user-id and password. This authentication remains in effect until your browser is closed or the site administrator changes your password. Of course, most browsers allow the user to save their authentication for the next session.

For an embedded audio file, right-click behavior is dependent on the plug-in chosen by the browser. QuickTime responds to right-click, but only users that have QuickTime Pro are allowed to save the file. However, the file name can still be revealed by viewing the page source [look at the src attribute of the <embed> tag]. With this information, an authenticated user can retrieve the sound file directly from your server just by entering the file's URL.


We start with a simple greeting ...

Peace be unto you.


and then in Arabic ...

السلام عليكم


with an embedded player for the sound file.

    Click the 'Play' button to listen.


Back to amstest homepage.




Notes


  1. The HTML used for the sound player is an <embed> tag with several attributes:
     <embed src="prot/fwas01vr.mp3"
            height="30" width="200" autostart="false">

    The 'src' attribute names the sound file to be played. Note that this file is located in a subdirectory named 'prot' (for "protected").
     
  2. You can specify that the sound file be automatically played each time the page is loaded by changing the 'autostart' attribute to "true".
     
  3. This time, the sound file has been converted to '.mp3' format.
     
  4. The browser chooses a plug-in player that is compatible with the format of the audio file. QuickTime seems to be the preferred player, but it could be something else depending on which plug-ins the user has installed.
     
  5. If you were playing a video (rather than a sound clip) then you would set the 'height' and 'width' attributes in the <embed> tag appropriately.
     
  6. The password protection on this and other pages is done with .htaccess and .htpasswd, so it is probably the same technique that you have already tried. It does everything you need, but requires intervention from a site administrator to add, remove, or change passwords. There is no way to set an expiration date for a password (but this could be accomplished with a cron job).
     
  7. The <embed> tag was invented by Netscape and is included in HTML-5 but this is not yet a standard. Embed is, however, currently supported by all major browsers.