JavaScript tutorial: Adding sound to your pages / PDF
JavaScript tutorial: Adding sound to your pages / PDF
Sample of the PDF document
Playing music using an ActiveX control
Note: ActiveX controls are currently supported only by Internet Explorer.
Use your JavaScript Editor to open Music.htm (in the Tutorial folder inside your JavaScript Editor folder) and examine the code.
To run the code click on the Show Internal Viewer button
To play a sound file (in this case Canyon.mid) the code uses the Media Player ActiveX. It ships with any installation of Windows and can be used to play sound, animations and video files.
An example of how to add Media Player to your Web page is given below. Only the most useful parameters are shown, for a complete list have a look at the Music.htm code.
<object id=MPlyr classid=CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95
align=left width=0 height=0 style="VISIBILITY: hidden">
Once the Media Player object is defined you can use its ID in your JavaScript functions to invoke the object's methods, such
as MPlyr.Play() or MPlyr.Pause().
In this example the Media Player plays the sound file but remains hidden (style="VISIBILITY: hidden"). By changing
the parameters you can control the size, appearance and other properties of the Player. Most importantly, by changing the
"Filename" parameter you can use it to replay AVI, MPEG, MOV, MP3 and other types of Multimedia files............
JavaScript tutorial: Adding sound to your pages / PDF
0 commentaires: