次の方法で共有


Settings.autoStart

[The feature associated with this page, Windows Media Player SDK, is a legacy feature. It has been superseded by MediaPlayer. MediaPlayer has been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer instead of Windows Media Player SDK, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The autoStart property specifies or retrieves a value indicating whether the current media item begins playing automatically.

Syntax

player.settings.autoStart

Possible Values

This property is a read/write Boolean.

Value Description
true Default. The media item begins playing automatically (see Remarks).
false The media item does not begin playing automatically.

Remarks

If autoStart is set to true, the media item will begin playing when Player.URL, Player.currentPlaylist, or Player.currentMedia is set. Otherwise, it will not start playing until the Controls.play method is called.

Because the autoStart property for the full mode of Windows Media Player can be set globally by external events (such as loading a CD), there is no reliable default value for skins and remoted Player controls. This is because the playback engine of the full mode Player is used in both cases.

You should set autoStart to false immediately before you set Player.URL, Player.currentPlaylist, or Player.currentMedia in skins and remoted Windows Media Player controls if you want to ensure that the media item does not start playing immediately. Also, unless you set autostart to true immediately before specifying a media item, you should not rely on this setting as a substitute for using the Controls.play method.

Examples

The following example creates an HTML CHECKBOX element that allows the user to specify whether the Player control plays the current media item automatically. The Player object was created with ID = "Player".

<!-- Create an HTML CHECKBOX control. -->
<INPUT  TYPE = "CHECKBOX" ID = AS
              onClick = "
    /* Use the CHECKBOX state to specify the value 
       of the autoStart property. */
    Player.settings.autoStart = AS.checked;
"> 

Requirements

Requirement Value
Version
Windows Media Player version 7.0 or later.
DLL
Wmp.dll

See also

Player.currentMedia

Player.URL

Settings Object