MediaSyncEvent

This Event subclass represents media synchronization events, which occur when a window loads new media due to a new game selection, after returning from a launched game session, or for any other reason. Media synchronization events let you intervene in the media loading process (for example, you could change the image that a window loads, or prevent loading a particular video), and also can be used to coordinate your own custom displays in a window (using Drawing Layers, for example) with background media changes.

The basic media sync event type comes in the following subtypes:

A mediasyncbegin event is always fired at the start of the process, and a mediasyncend always fires at the end of the process, no matter what the outcome. You can count on these events being paired, so you can use the "done" phase to unwind any global state that you set up in the "begin" or "load" phase.

Media sync events are fired on the window object representing the window that's loading a new background. When a new game is selected, the system visits each window in sequence and loads its media, so the media sync events will occur in that same sequence.

Properties

This event type has all of the standard event properties and methods (see the Event class), plus the following:

All of the file properties (image, video, defaultImage, defaultVideo) contain complete Windows filenames, with drive letter, folder path, and extension. If you change any of these, you must also use the same absolute path format, since PinballY will simply pass these strings to Windows directly to attempt to open the named files. You can set any of these to null to remove it from consideration.

The reason that multiple file properties are present is that the system treats these four as a series of back-up options if any of them can't be found or if any errors occur trying to load them. The system visits the files in the following order, stopping at the first one that successfully loads:

If video is missing (meaning that the system couldn't find any video files in the Media folder for the game), or if an error occurs when PinballY attempts to load the video file (e.g., the file doesn't contain valid video data, or can't be opened for some reason), the system moves on to image as the next best candidate. If no image file was found for the game, or an error occurs loading the file, PinballY next tries defaultVideo, and finally defaultImage.

Note that video playback can be disabled by the user as an option setting. When videos are disabled, the video and defaultVideo properties won't be present, since the system doesn't consider those as candidates for the background media.