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.
To open the WebIDE in Firefox Desktop, select Tools > Web Developer > WebIDE from the main menu:
Now click Open App in the upper-left corner of WebIDE and choose New App… from the menu:
Select HelloWorld, enter the Project Name and click OK:
After specifying the directory to save the project in, WebIDE generates an app for you containing simple template code:
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.
- Follow the instructions in Simulating Firefox OS for TV on your desktop to launch the TV environment inside the Firefox OS simulator.
- 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.
- In WebIDE, click Select Runtime in the upper-right corner then select Remote Runtime from the menu.
- Enter localhost:6000 in the dialog box and click OK:
- Click the Install and Run icon (the "Play" icon) in the WebIDE. You should now see your app running inside the Firefox OS Simulator:
- 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.
app-deck are good apps to use as starter templates for your own apps, or to get ideas and inspiration from.