Share via


Script Files (.js)

This is preliminary documentation and subject to change.

HD DVD uses a full-featured scripting language based on the open-standard ECMAScript 3rd Edition Compact Profile. ECMAScript is sometimes incorrectly referred to as Microsoft JScript or JavaScript. Both JScript and JavaScript are, in fact, extensions of ECMAScript.

The following is a short script example:

// Example function to fade in a menubar.
function FadeInMenuBar()
{
    // Get iHD markup object with id 'menubar'.
    var menuBar = document.menubar;
    // Animate the opacity from 0 to 1 over a period 
    // of 1.5 seconds. (This will make the menu fade in.)
    menuBar.style.animateProperty("opacity", "0.0;1.0", 1.5);
}

Differences from JScript

The scripting language used by iHD applications (a variant of ECMAScript) has the following significant differences from JScript:

  • There is no with statement.
  • There is no eval function.
  • There is no automatic semicolon insertion.
  • There are no line continuation characters.
  • Some functions, such as substr, escape, and unescape, are not implemented.

Objects

Some of the objects that are exposed to the script by the DVD player are:

Application object

The Application object is used for low-level tasks such as manual drawing to the graphics pane, file input/output, connecting to a network, running diagnostics, managing the controller, and controller events.

Player object

The Player object exposes, among other things, the capabilities of the HD DVD player, the playlist, bookmarks, and video playback settings.

Playlist object

The Playlist object, which is accessible from the Player object, is especially important, because it contains all of the titles loaded by the DVD player. This is the object that you use to jump to chapters, query the lengths of chapters, query or set the current title, query the play state, and so on.

For more information about the objects that can be manipulated by using script, see Annex Z of the HD DVD specification.

See Also