Media Types

A Media Type is a data record inside PinballY that describes, in concrete programming terms, one of the media items that PinballY displays in its various windows. There are media types defined for the main background media displayed in the different windows (playfield images and videos, backglass images and videos, etc), and for several types of supplemental media, such as advertising flyer images, instruction cards, and game wheel icons. To a large extent, the built-in media types correspond to the standard media found in the HyperPin media packs distributed on the virtual pinball sites.

In addition to the pre-defined media types that the system uses in its own windows, Javascript code can define additional, custom types. This is done via GameList.createMediaType(). Custom types are useful with custom media windows - new windows that you create through Javascript code, which appear alongside the standard windows and can perform the same function of displaying a particular kind of media associated with the selected game. Custom media types and custom media windows work together by letting you add new kinds of windows that act very much as though they were part of PinballY's standard window set. You can also use custom media types for other purposes, such as adding new kinds of files for use in custom graphics.

Built-in media types

Here's a list of the pre-defined media types built into PinballY. The ID gives the identifier that you use to refer to the media type in Javascript functions, such as gameInfo.resolveMedia() or mainWindow.createMediaWindow(). The Menu order gives the sorting order when media types are listed in system menus; the media types included in a menu are arranged in ascending order of the Menu order number.

IDDescriptionMenu Order
"bg image"Backglass image500
"bg video"Backglass video510
"dmd image"DMD window image600
"dmd video"DMD window video 610
"flyer image"Advertising flyer images300
"inst card image"Instruction card images200
"launch audio"Game launch audio400
"real dmd color image"Real DMD image, for color DMD810
"real dmd color video"Real DMD video, for color DMD830
"real dmd image"Real DMD image, for monochrome DMD800
"real dmd video"Real DMD video, for monochrome DMD820
"table audio"Playfield audio track430
"table image"Playfield image410
"table video"Playfield video420
"topper image"Topper window image700
"topper video"Topper window video710
"wheel image"Wheel icon100

Custom media types

You can use Javascript to create your own custom media types, adding to the types that PinballY knows about out of the box.

To create a custom type, you call GameList.createMediaType(desc). desc is a descriptor object with properties that describe the new media type.

Here are the properties you can use in the descriptor object desc. All of these are required except for the ones marked as optional. An error will be thrown if any of the required properties are missing or use an invalid format.

Calling the method creates a new media type based on the descriptor, and adds it to the system's internal list of types. You can use it from Javascript from that point forward by referencing the id string you provided.

The method has no return value. This might seem a little strange, since "creating" something usually returns an object representing that thing. In this case, there's no Javascript object representing the newly created media type; a media type is just an internal list entry within PinballY. In Javascript contexts where you need to refer to a media type, you do so using the id string you provided in the descriptor.