Profiling Your App

Senza apps operate in two modes:

  1. Foreground mode, in which the viewer interacts with the web browser using the remote control.
  2. Background mode, in which video streams directly to the cloud connector.

Usage is metered according to how much time the web browser is running. As you develop your app, it will be useful for you to be able to profile how much time the app spends in the foreground or the background. This will depend on what your app does and how it is structured.

Use cases

For a typical interactive TV app, the viewer may spend a small portion of the time selecting content in your application's menus, and the rest of their time watching content. Typical foreground usage is often around 5% of the time while they are using the app.

If the viewer stops interacting with your app while in foreground mode (such as while making a cup of tea), you should switch to background mode to save resources. The Stream Saver app demonstrates how to play a video after 30 seconds of inactivity.

A future release of the Senza platform will support the ability to pause the browser, switching to background mode while showing the last video frame from the browser instead of streaming a video.

If you are implementing a digital signage use case, your app may alternate between showing web content and playing video according to your own business logic. The amount of time that is spent in foreground or background mode will depend upon your script, but should be predictable.

Profiling

The Stopwatch class can help you understand the behavior of your app by counting the amount of time spend in foreground and background modes, and displaying the totals in a banner overlay. It also calculates the percent of time spent in foreground mode so you can predict how your app would behave over a longer period of time. You easily can drop the class into your existing app to profile it.