Partager via


ClosedCaption.captioningID

[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 captioningID property specifies or retrieves the name of the element displaying the captioning.

player.closedCaption.captioningID

Possible Values

This property is a read/write String.

Remarks

The element name specified can be any HTML element in the webpage as long as it supports the innerHTML attribute. If the webpage contains multiple frames, the element name can only refer to an element in the same frame as the Player control.

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

Examples

The following Microsoft JScript example uses ClosedCaption.captioningID to choose the area of a webpage used to display captions. Two HTML DIV elements were created, with ID = CC1 and ID = CC2, respectively. The Player object was created with ID = "Player".

<!-- Create two HTML BUTTON elements to allow the user to choose a display region. -->
<INPUT TYPE = "BUTTON"  NAME = "SET1"  VALUE = "Move Caption to CC1"
       OnClick = "
           /* Clear the caption text from the other DIV */
           CC2.innerHTML = 'This is the CC2 DIV';

           /* Show the captions in the DIV named CC1. */ 
           Player.ClosedCaption.captioningID = 'CC1';
          ">

<INPUT TYPE = "BUTTON" NAME = "SET2" VALUE = "Move Caption to CC2"
       OnClick = "
           /* Clear the caption text from the other DIV */
           CC1.innerHTML = 'This is the CC1 DIV';

           /* Show the captions in the DIV named CC2. */
           Player.ClosedCaption.captioningID = 'CC2';
          ">

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