Le opzioni in html per Windows Media si trovano in questo documento della Microsoft
senza però le indicazioni di apertura e chiusura del tag
Embedding Windows Media Player
You can build Windows Media Player into a Web page by embedding it. The first advantage of embedding is that you have complete control over the look of the player and how it functions-in other words, the entire user experience. You can create a player that works with the design of a page, and you can expose only those functions that are appropriate. You can, for example, expose only two buttons-play and stop-and set the player to play only one file.
The second advantage of embedding is that along with being able to control the player with Web page script, you can add script that enables you to control the Web page with the player. You can, for example, add script commands to a Windows Media file or live stream that changes images in a frame or sends Dynamic HTML commands to Microsoft Internet Explorer in synchronization with the media. For more information about using script commands, see Windows Media Player-Advanced Scripting for Cross-Browser Functionality.
Note Embedding Windows Media Player in a Web page gives you complete control of the user experience within a browser. If you want control of the user experience outside the browser, you can create custom player skins. For more information, see Creating Custom Skins for the New Windows Media Player 7.
Using the Version 7 Control
To embed Windows Media Player, you add an OBJECT element for the Windows Media Player ActiveX® control. End users who have Windows Media Player installed on their computers can open your Web page and the OBJECT element will open the player control in the page. The following HTML example opens the Windows Media Player 7 control with a set size of 320 by 240 pixels:
HTML
HEAD
TITLE Embedded Windows Media Player Control TITLE
HEAD
BODY
OBJECT ID="Player" width="320" height="240"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
OBJECT
BODY
HTML
The CLASSID number is unique to version 7 of the Windows Media Player control. If an end user has an older version, the player will not open. Version 7 has a unique ID because the new player has an improved scripting model that is not compatible with older versions. If you are using the new scripting model, the unique ID prevents users with older players from getting script errors when they attempt to open the page. You can add script, such as the following VBScript example, to test for the presence of version 7. If version 7 is not installed, a message box opens to tell users how to install it:
SCRIPT LANGUAGE="VBScript"
!--
On error resume next
Player.URL = ""
if err then msgbox "You need Windows Media Player 7." & chr(13) &_
"Go to http://www.microsoft.com/windowsmedia"
err.clear
--
SCRIPT
If Windows Media Player 7 cannot be opened, an error is raised when the Player.URL method is called. The If statement tests for the presence of an error and opens a message box if one occurs.
Using the Version 6.4 Control
The alternative is to embed the version 6.4 ActiveX control. Because version 6.4 functionality is included in the version 7 installation, any version 6.4-compatible script you add will be compatible with either version of Windows Media Player. There are also other reasons why you may want to use version 6.4-compatible script:
* Your end users cannot install version 7. The new version of the player cannot be installed on older Microsoft operating systems, such as Windows® 95 and Windows NT®.
* You want to support Netscape browsers. Version 7 does not include a plug-in for Netscape Web browsers.
* You plan to embed the control in an application. Version 7 does not support embedding the control using Microsoft Visual Basic® or Visual C++®. This does not directly relate to Web page embedding, but it is useful to know if you plan to create programs that use the control.
By embedding the version 6.4 ActiveX control and Netscape plug-in, users with any Microsoft operating system and the most popular browsers can install and open Windows Media Player in your Web page. Most of the functionality of the embedded version 7 player is also available in version 6.4. We suggest you use version 7. But if there is a reason why you cannot, version 6.4 works equally well for most situations where it is used for embedding.
To embed the version 6.4 control in a Web page, you use an OBJECT element with the version 6.4 CLASSID number. To add support for Netscape users, you add the version 6.4 plug-in with an EMBED tag. The following OBJECT element opens the version 6.4 player in Microsoft Internet Explorer or Netscape Navigator:
OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject">
EMBED TYPE="application/x-mplayer2"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=240
EMBED
OBJECT
Using the CODEBASE attribute
If you are embedding the version 6.4 player, you can add a CODEBASE attribute to the OBJECT element. With CODEBASE added, a check is done to determine the presence of Windows Media Player on an end user's computer. CODEBASE specifies a URL, and can specify a version. If the correct version of the player is not installed on the computer, it is installed automatically from the location given in the URL.
The following CODEBASE script automatically installs the correct version 6.4 player from the Microsoft Web site.
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
Adding PARAM Elements
With Windows Media Player embedded in your Web page, you can add script that controls the player's look and functionality. The PARAM element enables you to specify certain player properties when the page opens. You can specify properties such as the name of the file or URL that you want the player to open, and how you want the player to appear.
The following version 7 script example uses the PARAM element to set the AUTOSTART property of the player to TRUE, and the URL property to the location of a Windows Media metafile:
HTML
HEAD
TITLE Embedded Windows Media Player 7 Control TITLE
HEAD
BODY
OBJECT ID="Player" width="320" height="240"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
PARAM name="autoStart" value="True"
PARAM name="URL" value="http://WebServer/MyFile.wvx"
OBJECT
BODY
HTML
With AUTOSTART enabled, the file or stream specified by the URL plays automatically as soon as the player control opens.
The same functionality can be added to the version 6.4 control and plug-in with the following script:
HTML
HEAD
TITLE Embedded Windows Media Player 6.4 Control TITLE
HEAD
BODY
OBJECT ID="MediaPlayer" WIDTH=320 HEIGHT=240
CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95"
STANDBY="Loading Windows Media Player components..."
TYPE="application/x-oleobject"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112"
PARAM name="autoStart" value="True"
PARAM name="filename" value="http://WebServer/MyFile.wvx"
EMBED TYPE="application/x-mplayer2"
SRC="http://WebServer/MyFile.wvx"
NAME="MediaPlayer"
WIDTH=320
HEIGHT=240>
EMBED
OBJECT
BODY
HTML
Note that the only difference besides the version 6.4 OBJECT attributes is the name of the method for opening media: Filename. The SRC attribute is used to specify the URL for the plug-in. The functionality between the two versions is very similar. The main difference is in the organization of the script functions and the look of the player. In version 7, the control is split into subcontrols. For more information, see the Windows Media Player 7 SDK.
Adding Scripting
With the Windows Media Player control embedded and PARAM properties set, you can add script that controls player functions. The following script adds two input buttons:
The buttons work with the following Microsoft JScript® script to start and stop the player:
SCRIPT
!--
function StartMeUp ()
{
Player.URL = "http://WebServer/MyFile.wvx";
}
function ShutMeDown ()
{
Player.controls.stop();
}
-->
SCRIPT
The following complete HTML script embeds the Windows Media Player 7 control, sets the URL PARAM, embeds two buttons, and contains scripting to make the buttons work. It also contains script to pop up a message box if an end user does not have the version 7 player installed.
HTML
HEAD
TITLE Embedded Windows Media Player 7 Control TITLE
HEAD
BODY
OBJECT ID="Player" width="320" height="240"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"
PARAM name="URL" value="http://WebServer/MyFile.wvx"
PARAM name="uiMode" value="none"
OBJECT
SCRIPT
!--
function StartMeUp ()
{
Player.controls.play();
}
function ShutMeDown ()
{
Player.controls.stop();
}
--
SCRIPT
SCRIPT LANGUAGE="VBScript"
!--
On error resume next
Player.URL = ""
if err then msgbox "You need Windows Media Player 7. Go to" & chr(13) &_
"http://www.microsoft.com/windowsmedia"
err.clear
--
SCRIPT
/BODY
/HTML
Note that the uiMode property was also added as a PARAM. With this property set to none, the player opens without any controls.
You can adapt this script for the version 6.4 control and plug-in by substituting the OBJECT elements, adding the plug-in elements, and changing two player methods. In the StartMeUp function change the method to Player.play(), and in the ShutMeDown() function to Player.stop(). Both of these changes are related to the reorganization of the functions in version 7.
There are two main sources of additional information about using Windows Media in a Web page:
1. The other articles in the Web Authoring section of the Windows Media Web Workshop.
2. The Windows Media Player 7 SDK, which is part of the Windows Media SDK.
Another source is the Windows Media Player 7 Handbook from Microsoft Press, which contains complete information about the player, including how to use the player, create skins, and embed the player in Web pages and programs. For more information, see your favorite online bookseller.