The Coho Winery Webmaster embeds the Player in the winery Web page and includes code for both Internet Explorer and Netscape Navigator. She specifies the height and width of the Player to make sure it appears correctly. She also uses the UI mode parameter, setting the value to “none” so no user controls are visible on the page.
Figure 7.17. shows the completed Coho Winery Web site with an embedded Player.
Figure 7.17: The Coho Winery Web site with an embedded Player control.
The HTML looks like this:
<HTML> <HEAD> <TITLE>Coho Winery</TITLE> </HEAD> <BODY> <script language="JavaScript"> if (navigator.appName == "Netscape") { document.writeln("<APPLET NAME=’WMPEmbed’’MAYSCRIPT HEIGHT=’240' WIDTH=’320' CODE=’WMPNS.WMP’>"); document.writeln("<PARAM NAME=’autoStart’’VALUE=’False’/>"); document.writeln("<PARAM NAME=’URL’’ VALUE=’http://ncwms/test.asx’/>"); document.writeln("<PARAM NAME=’uiMode’’VALUE=’MINI’/>"); document.writeln("</APPLET>"); } else { document.writeln("<OBJECT ID=’WMPEmbed’’height=’240' width=’320' CLASSID=’CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'>"); document.writeln("<PARAM NAME=’autoStart’’VALUE=’FALSE’/>"); document.writeln("<PARAM NAME=’URL’’ VALUE=’http://ncwms/test.asx’/>"); document.writeln("<PARAM NAME=’uiMode’’VALUE=’MINI’/>"); document.writeln("</OBJECT>"); } </script> <form align=center > <INPUT TYPE="BUTTON""NAME="BtnPlay""VALUE="Play"" OnClick="Player_Start()""> <INPUT TYPE="BUTTON""NAME="BtnStop""VALUE="Stop"" OnClick="Player_Stop()""> <INPUT TYPE="BUTTON""NAME="BtnPause""VALUE="Pause"" OnClick="Player_Pause()""> </form> <SCRIPT> <!— function Player_Start () { if (navigator.appName == "Netscape") { document.WMPEmbed.getControls().play(); } else { document.WMPEmbed.controls.play(); } } function Player_Stop () { if (navigator.appName == "Netscape") { document.WMPEmbed.getControls().stop(); } else { document.WMPEmbed.controls.stop(); } } function Player_Pause () { if (navigator.appName == "Netscape") { // 2 == Paused if (document.WMPEmbed.getPlayState() == 2) document.WMPEmbed.getControls().play(); else document.WMPEmbed.getControls().pause(); } else { // 2 == Paused if (document.WMPEmbed.playState == 2) document.WMPEmbed.Controls.Play(); else document.WMPEmbed.Controls.Pause(); } } //—> </SCRIPT> </BODY> </HTML>