Skip to content
CF MEDIA

Menus and pages

A menu has tabs (on the TV, on the left; on the phone, at the top). Each tab opens a page, which is a grid of items.

menu.json
{
  "headline": "My Media",
  "menu": [
    { "type": "separator", "label": "My Media" },
    { "icon": "movie", "label": "Videos", "data": "http://{SERVER}/cfmedia/videos.json" },
    { "icon": "music-note", "label": "Music", "data": { "items": [ { "title": "Track 1" } ] } },
    { "icon": "settings", "label": "Settings", "action": "settings" }
  ]
}
Menu item fieldDescription
labelTab text
iconIcon (names)
dataThe page for this tab: a JSON URL, or the page written right there
actionInstead of opening a page, runs an action
type: "separator"A title or divider between tabs (label optional)
focus: trueStarts on this tab
display: falseHides the tab

Page

videos.json
{
  "headline": "Videos",
  "background": "http://{SERVER}/img/background.jpg",
  "template": { "layout": "0,0,3,2", "color": "cf-glass", "icon": "movie" },
  "items": [
    { "title": "Beach holiday", "titleFooter": "12 min", "action": "video:http://{SERVER}/media/holiday.mp4" },
    { "title": "Graduation", "titleFooter": "24 min", "action": "video:http://{SERVER}/media/graduation.mp4" }
  ],
  "ready": { "action": "info:Welcome!" }
}
Page fieldDescription
headlineTitle at the top
logoImage in the corner of the title
backgroundBackground image (URL, or {"image": URL})
templateDefault values for all items (below)
itemsThe items on the page
pagesInstead of items: a list of pages, each with its own items and template
ready.actionAction run when the page opens

The 12×6 grid

On the TV, each page is a grid of 12 columns by 6 rows. An item’s layout is "column,row,width,height":

layoutResult
"0,0,12,6"One item filling the whole page
"0,0,6,3"Half the width, half the height, in the top-left corner
"0,0,3,2"12 items per page (4 × 3). This is the default when nothing is given
"0,0,2,4"Tall, poster-style items: 6 per row

With layout only in the template, items fit themselves in, row by row. When the page is full, another one starts, and the user moves to it with the arrows. On a phone in portrait, CF media rearranges the grid into a scrolling double column, without you changing anything.

tips_and_updates
Want to control every position? Put layout on each item. Items with their own layout are not part of the automatic fitting.

Template

Anything that can go in an item can go in the template, and it applies to every item on the page. Whatever the item has on its own wins over the template.

template
{
  "template": { "layout": "0,0,4,3", "color": "#2d3a6b", "icon": "photo_library", "imageFiller": "cover", "action": "image:context" },
  "items": [
    { "title": "Trips", "image": "http://{SERVER}/photos/trip.jpg" },
    { "title": "Family", "image": "http://{SERVER}/photos/family.jpg", "color": "#5b2a4a" }
  ]
}