Data components

Some components fetch their data from elsewhere:

Data component

The Data component has 3 parameters:

Plain Data with URL

When only a URL is specified, the Data component behaves like a Text component. An AJAX call is made to the URL provided, and the fetched text is inserted as is in the component. The fetched text may be plain text or a URL fragment.

Using a fetching period

When a period is specified, the AJAX call is executed every period seconds, and the content of the component is updated.

Using a template

When a template string is provided, the Data component assumes that the fetched data is in the form of a JSON object.

The template string contains tags between that are replaced with the value of the tag property in the fetched data (in the manner of JS moustache or JS handlebars).

Example:

| <h1></h1><hr/><p></p> | |—|

{
  "userId": 1,
  "title": "quod erat",
  "para": "qui ullam ratione quibusdam voluptatem quia omnis",
  "completed": false
}

|<h1>quod erat</h1><hr/><p>qui ullam ratione quibusdam voluptatem quia omnis</p></code> |—|

| <h1>quod erat</h1><hr/><p>qui ullam ratione quibusdam voluptatem quia omnis</p> | |—|

DataFromStreamEvent component

The DataFromStreamEvent has 5 parameters:

Id, name and tag of the Stream Event to listen to are HbbTV parameters. If you do not know, the default values should be OK for you. Otherwise, your broadcasting team will give you approriate values.

The initial text is the text that is displayed before any event is received.

The template is of the same type as the Data component.

Plain event

Without template, the DataFromStreamEvent component behaves like a Text component. When receiving a Stream Event of matching parameters, the data from the event is extracted and placed into the component. The event data may be plain text or a URL fragment.

Using a template

When a template string is provided, the DataFromStreamEvent component assumes that the fetched data is in the form of a JSON object.

The template string contains tags between that are replaced with the value of the tag property in the fetched data (in the manner of JS moustache or JS handlebars).

Example:

|<h1></h1><hr/><p></p>| |—|

{
  "userId": 1,
  "title": "quod erat",
  "para": "qui ullam ratione quibusdam voluptatem quia omnis",
  "completed": false
}

|<h1>quod erat</h1><hr/><p>qui ullam ratione quibusdam voluptatem quia omnis</p>| |—|

|<h1>quod erat</h1><hr/><p>qui ullam ratione quibusdam voluptatem quia omnis</p>| |—|