Documentation Archive

Developer

Apple TV Markup Language Reference

On This Page

mainTemplate

Use the main template (mainTemplate) to display options to the user; for example, the main page for a movie with options to play the movie, see extra content, and jump to specific scenes. The background area contains an image relating to the product, and the options are contained in a menu bar along the bottom of the screen. Figure 10-1 shows the basic layout for a mainTemplate page. The default theme for a main template is dark.

Figure 10-1Main template image: ../Art/ATV_temps_main_2x.png

Main Elements of the Main Template

Listing 10-1 shows main elements in TVML format, and Table 10-1 describes the main elements.

Listing 10-1mainTemplate TVML format
  1. <mainTemplate>
  2. <background>…</background>
  3. <menuBar>
  4. <section>
  5. <menuItem>…</menuItem>
  6. <menuItem>…</menuItem>
  7. </section>
  8. </menuBar>
  9. </mainTemplate>

Table 10-1mainTemplate element descriptions

Element name

Description

background

The background elements used on the page, such as audio.

menuBar

A list of displayed menu items.

menuItem

Information for an individual menu item.

section

An area containing a group of menu items.

Main Template Example

Listing 10-2 shows the TVML for a mainTemplate example.Figure 10-2 shows the output for the example. The example displays a full-screen image as the background. A menu bar contains three navigable options.

Listing 10-2mainTemplate example TVML
  1. <document>
  2. <mainTemplate>
  3. <background>
  4. <img src="path to images on your server/Car_Movie_1920x1080" />
  5. </background>
  6. <menuBar>
  7. <section>
  8. <menuItem>
  9. <title>PLAY</title>
  10. </menuItem>
  11. <menuItem>
  12. <title>SCENES</title>
  13. </menuItem>
  14. <menuItem>
  15. <title>EXTRAS</title>
  16. </menuItem>
  17. </section>
  18. </menuBar>
  19. </mainTemplate>
  20. </document>
Figure 10-2mainTemplate example output image: ../Art/mainTemplateSS_2x.png