Firefox OS for TV hello world example

This article introduces a simple hello world example, showing how easy it is to build up a TV app and test it in a simulator. For this article we'll use WebIDE.

Building up our hello world

Let's build up a test app.

  1. To open the WebIDE in Firefox Desktop, select Tools > Web Developer > WebIDE from the main menu:

  2. Now click Open App in the upper-left corner of WebIDE and choose New App… from the menu:

  3. Select HelloWorld, enter the Project Name and click OK:

  4. After specifying the directory to save the project in, WebIDE generates an app for you containing simple template code:

  5. Now you can program your app directly within WebIDE, or use any other editor that you prefer to edit your code.

Running your app on TV

If you have a Panasonic VIERA Firefox OS TV, you can find out how to run your apps on the TV via WebIDE by reading How to connect WebIDE to TV (VIErA CX/CR series). If not, read on.

  1. Follow the instructions in Simulating Firefox OS for TV on your desktop to launch the TV environment inside the Firefox OS simulator.
  2. If you are using the available Firefox 2.6 simulator, simply skip to step 5. If you are using your own custom build, read on.
  3. In WebIDE, click Select Runtime in the upper-right corner then select Remote Runtime from the menu.
  4. Enter localhost:6000 in the dialog box and click OK:
  5. Click the Install and Run icon (the "Play" icon) in the WebIDE. You should now see your app running inside the Firefox OS Simulator:
  6. Click the Debug App icon (the "Tool" icon) in WebIDE to debug your app directly on the simulator using the DevTools Toolbox:

Note: Find out more about debugging your apps by reading Debugging apps.

Where to go next

Building web apps for TV mostly requires the same skills as building web apps generally; there are a few extra considerations to bear in mind, which are discussed in other articles linked from our Firefox OS for TV page.

In terms of getting inspiration from existing apps, your can look at the apps that come with Gaia. Gaia 2.1 and above contains facilities for running on TV, and you can find apps for smart TVs in the gaia/tv_apps directory. smart-home and app-deck are good apps to use as starter templates for your own apps, or to get ideas and inspiration from.