Compartilhar via


ClosedCaption.SAMILang

[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 SAMILang property specifies or retrieves the language displayed for closed captioning.

player.closedCaption.SAMILang

Possible Values

This property is a read/write String.

Remarks

A SAMI file can contain text for one or many languages. The languages available for closed captioning are defined between the <STYLE> and tags in the SAMI file. A language identifier is specified with a unique alphanumeric string that is preceded by a period (.). The name specified for a language can be any string. For example, the following could be used to define US English:

.ENUSCC {Name:'English Captions' lang: en-US; SAMIType:CC;}

If no SAMI language is specified, the first language defined in the SAMI file is used by default.

The value you pass using ClosedCaption.SAMILang must match the Name attribute in the language specifier.

Windows Media Player 10 Mobile: This property is read only, and always returns an empty string.

Examples

The following JScript example uses ClosedCaption.SAMILang in an HTML SELECT element to specify the closed caption language. The Player object was created with ID = "Player".

<!-- Create the SELECT element. -->
<SELECT ID = CCLANG  NAME = "CCLANG"  LANGUAGE = "JScript"

     /* Set the closed caption language when the SELECT element changes. */
        onChange = "Player.closedCaption.SAMILang = CCLANG.value;
        ">

        /* Fill in the SELECT element options. */
           <OPTION VALUE = "'Spanish Captions'">Spanish
           <OPTION VALUE = "'Japanese Captions'">Japanese
           <OPTION VALUE = "'English Captions'">English
           <OPTION VALUE = "'French Captions'">French
           <OPTION VALUE = "'German Captions'" SELECTED>German
</SELECT>

Requirements

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

See also

Adding Closed Captions to Digital Media

ClosedCaption Object