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:
HEAD>
Body>
Html>
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">
Object>
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.
Function startMeup ()
{
Player.url = "laure.wma";
}
Function shutmedown ()
{
Player.Controls.stop ();
}
->
Script>
THE EXAMPLE FUNCTION, STARTMEUP, IS CALLED WHEN The Button Marked Play IS CLED IS CLED IS CLED.
The Code Inside Startmeup Uses The Url Property To Define a path to the media. The Media Will Start Playing Immediately.
.............. ..
The Following Code Shows A Complete Example.
HEAD>
ClassID = "CLSID: 6BF52A52-394A-11D3-B153-00C04F79FAA6">
Object>
Function startMeup ()
{
Player.url = "laure.wma";
}
Function shutmedown ()
{
Player.Controls.stop ();
}
->
Script>
Body>
Html>
Note That You Must Provide a Valid Url To a Valid File Name In The Url Property. In This Case The Assumption Is in The File Laure.wma is in The Same Directory As The Html File. This is a section of COPY from the MSDN's SDK Some problems, such as Play and STOP issues, this is easy to explain with MediaId.controls.play () and MediaId.controls.play () and MediaId.controls.play () and Media.Control.Stop version of MediaID.controls.play () and MediaID.controls.play () and Media.Control.stop );
Controls.currentItem
The CurrentItem Property Specifies Or Retrieves The Current Media Item.
Syntax
Player.Controls.currentItem
Possible Values
This Property is a read / write media object.
Remarks
This Method Works Only With items in Player.currentPlayList. Calling CurrentItem with a reference to a Saved Media Item Is Not Supported.
Example Code
The following JScript example uses currentItem to set the player control current media item to the selected value in an HTML SELECT element. The current playlist was first specified by using PlaylistCollection.getByName. The Player object was created with ID = "Player".
/ * Specify the current item for the success limited list value change. * /
Onchange = "Player.Controls.currentItem = Player.currentPlayList.Item (PlayItem.Value);">>>>>>>>>>>>
/ * Fill The Select Element List with Three Items That Match
The Songs in the playlist. * /
Laure
jeanne
HOUSE
Select>
Controls.currentItemthe CurrentItem Property Specifies Or Retrieves The Current Media Item.SYNTAXPLAYER.CONTROLS.CURRENTITEM
Possible ValuesThis property is a read / write Media object.RemarksThis method works only with items in Player.currentPlaylist. Calling currentItem with a reference to a saved media item is not supported.Example CodeThe following JScript example uses currentItem to set the player control current media item to the selected value in an HTML SELECT element. The current playlist was first specified by using PlaylistCollection.getByName. The Player object was created with ID = "Player".
/ * Specify the current item for the success limited list value change. * /
Onchange = "Player.Controls.currentItem = Player.currentPlayList.Item (PlayItem.Value);">>>>>>>>>>>>
/ * Fill The Select Element List with Three Items That Match
The Songs in the playlist. * /
Laure
jeanne
HOUSE
Select>
Obviously Controls has a lot of things, we can control a lot of controls.nextthe next method sets the current item to the next item in the playlist.syntaxplayer.Controls.next ()
ParametersThis method takes no parameters.Return ValuesThis method does not return a value.RemarksIf the playlist is on the last entry when next is invoked, the first entry in the playlist will become the current one.For server-side playlists, this method skips to the next item in the server-side playlist, not the client playlist.When playing a DVD, this method skips to the next logical chapter in the playback sequence, which may not be the next chapter in the playlist. When playing DVD stills, this method skips to the next still.Example CodeThe following example creates an HTML BUTTON element that uses next to move to the next item in the current playlist. The Player object was created with ID = "Player".
All of these in Microsoft's SDK, size is 10m, can be downloaded here to just write some usage in the web Script, can be controlled with VB VC, Controls is obviously very convenient