Handling DVD Event Notifications
Microsoft DirectShow 9.0 |
Handling DVD Event Notifications
This component is available for use in the Microsoft Windows 2000, Windows XP, and Windows Server 2003 operating systems. It may be altered or unavailable in subsequent versions.
The MSWebDVD object sends notifications to an application-specified method when certain events take place, such as when the DVD domain changes, when a new parental management level is encountered, when it is about to enter an angle block, and so on. The event parameters can contain additional information related to the event. Error messages and warnings are also sent in this way. To capture the various DVD event notifications, enter the following HTML SCRIPT tag below the OBJECT tag for the MSWebDVD object.
<SCRIPT LANGUAGE="JScript" FOR=DVD EVENT="DVDNotify(EventCode, Param1, Param2)"> ProcessDVDEvent(EventCode, Param1, Param2) </SCRIPT>
Then, in script, define the event codes and the ProcessDVDEvent function, as shown in the next code example. (You may give your event handling function any name; it isn't required to be "ProcessEvents." For more information about the event codes, see DVD Event Notification Codes.
<SCRIPT LANGUAGE="JScript"> // DVD event codes are valued 257 through 283 var EC_DVDBASE = 256; var EC_DVD_DOMAIN_CHANGE = (EC_DVDBASE + 1); var EC_DVD_TITLE_CHANGE = (EC_DVDBASE + 2); var EC_DVD_CHAPTER_START = (EC_DVDBASE + 3); var EC_DVD_AUDIO_STREAM_CHANGE = (EC_DVDBASE + 4); var EC_DVD_SUBPICTURE_STREAM_CHANGE = (EC_DVDBASE + 5); var EC_DVD_ANGLE_CHANGE = (EC_DVDBASE + 6); var EC_DVD_BUTTON_CHANGE = (EC_DVDBASE + 7); var EC_DVD_VALID_UOPS_CHANGE = (EC_DVDBASE + 8); var EC_DVD_STILL_ON = (EC_DVDBASE + 9); var EC_DVD_STILL_OFF = (EC_DVDBASE + 10); var EC_DVD_CURRENT_TIME = (EC_DVDBASE + 11); // not used by MSWebDVD var EC_DVD_ERROR = (EC_DVDBASE + 12); var EC_DVD_WARNING = (EC_DVDBASE + 13); var EC_DVD_CHAPTER_AUTOSTOP = (EC_DVDBASE + 14); var EC_DVD_NO_FP_PGC = (EC_DVDBASE + 15); var EC_DVD_PLAYBACK_RATE_CHANGE = (EC_DVDBASE + 16); var EC_DVD_PARENTAL_LEVEL_CHANGE = (EC_DVDBASE + 17); var EC_DVD_PLAYBACK_STOPPED = (EC_DVDBASE + 18); var EC_DVD_ANGLES_AVAILABLE = (EC_DVDBASE + 19); var EC_DVD_PLAYPERIOD_AUTOSTOP = (EC_DVDBASE + 20); var EC_DVD_BUTTON_AUTO_ACTIVATED = (EC_DVDBASE + 21); var EC_DVD_CMD_START = (EC_DVDBASE + 22); // not used by MSWebDVD var EC_DVD_CMD_END = (EC_DVDBASE + 23); // not used by MSWebDVD var EC_DVD_DISC_EJECTED = (EC_DVDBASE + 24); var EC_DVD_DISC_INSERTED = (EC_DVDBASE + 25); var EC_DVD_CURRENT_HMSF_TIME = (EC_DVDBASE + 26); var EC_DVD_KARAOKE_MODE = (EC_DVDBASE + 27); var nCurDomain; var nCurParentalLevel; function ProcessDVDEvent(EventCode, Param1, Param2) { switch (EventCode) { case EC_DVD_DOMAIN_CHANGE: nCurDomain = Param1; // do something break; case EC_DVD_PARENTAL_LEVEL_CHANGE: nCurParentalLevel = Param1; // do something break; // handle any other events you are interested in default: break; } } </SCRIPT>