Some instructions about the Web using Media Player

xiaoxiao2021-03-06  41

SIMPLE EXAMPLE OF Scripting in A Web Page

You can easily embed the Windows Media Player control in an HTML file using any scripting language your browser recognizes. The following simple example uses Microsoft JScript to create a page that will play a file when you click on a button, and stop playing the file when You Click on another button.

You can Embed The Windows Media Player ActiveX Control In A Web Page STEPS:

Create The Web Page. Add the Object Tag. Add A User Interface. In this Case, Two Buttons. Add A Few Lines of code to respondhen the user click on one of the button you have create

Creating The Web Page

THE FIRID HTML Web Page:

Adding the object tag

Once you have created a Web page, you need to add an OBJECT tag. This identifies the ActiveX control to the browser and sets up any initial definitions. You must place the OBJECT tag in the BODY of the code. If you place it in the BODY, the default user interface of Windows Media Player will be visible. If you want to create your own user interface, set the height and width attributes to 0 (zero). you can also set the Player.uiMode property to "invisible" when You Want to Hide The Control, But Still Reserve Space for It on the page. The Following CODE IS Recommended WHEN You Provide a Custom User Interface:

ClassID = "CLSID: 6BF52A52-394A-11D3-B153-00C04F79FAA6">

The Following Object Tag Attributes Are Required:

Id

The name that will be used by other parts of the code to identify and use the ActiveX control. You can choose any name you want, as long as it is a name that is not already used by HTML, HTML extensions, or the scripting language YOU ARE Using. in this Example, The Name Player IS Used, But You Could Also Call IT MyPlayer OR Something Else. Just Pick A Name That Unque To That Web Page.classID

A very large hexadecimal number that is unique to the control. Only one control has this number and it is the Windows Media Player ActiveX control. To prevent typographical errors, you can copy and paste this number from the documentation. Versions of the Windows Media Player Control Prior to Version 7.0 Had a Different ClassID.

Add a user interface

HTML allows a vast wealth of user interface elements, allowing the user to interact with your Web page by clicking, pressing keys, and other user actions. Adding a few INPUT buttons is the easiest way to provide a quick user interface. The following code creates TWO Buttons That Can Respond to The User. Clicking One Button Starts The Media Stream Playing and The Other Button Stops IT:

The name of the button is used to identify the button to your code; the value is the label that will appear on the button, and the OnClick attribute identifies which part of your scripting code will be called when the button is clicked.

Add Scripting Code

Scripting code adds interactivity to your page. Scripting code can respond to events, call methods, and change run-time properties. Extended scripts are enclosed in a SCRIPT tag set. The SCRIPT tag tells the browser where your scripting code is and identifies the scripting language. If you do not identify a language, the default language will be Microsoft JScript.It is good authoring practice to enclose your script in HTML comment tags so browsers that do not support scripting do not render your code as text. Put the SCRIPT tag Anywhere within the body of your html file and embed the comment-surrounded code with the coming and closing script tages.

The Following Microsoft JScript Code Example Calls The Windows Media Player Control and Performs An Appropriate Action In Response To The Corresponding Button Click.