[Stingray] TV Web API for Searching Programs

RESOLVED WONTFIX

Status

RESOLVED WONTFIX
5 years ago
9 months ago

People

(Reporter: airpingu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [ft:conndevices])

User Story

We hope to provide Web APIs for searching TV programs based on the programs' metadata. Basically, two types of searching functions need to be supported:

  1. Search by the start time, the end time and the channel.

  2. Search by any kinds of fields, including name, genre, actor name... etc.

Also, this Web API has to be exposed to any kinds of third-party apps.
OIPF APIs provide some useful semantic for the clients to compose the searching filters. For example, the web developers can use "createQuery(fieldName)" plus "and"/"or"/... operators to decide how to search the desired programs. An example is shown as below:

  function getGuideData() {
    // Instantiate the search manager
    var mySearchMgr = window.oipfObjectFactory.createSearchManagerObject();
    mySearchMgr.addEventListener(“MetadataSearch”, searchUpdate);

    // Create the search object to search EPG data
    mySearch = mySearchMgr.createSearch(1);

    // Get the start time for the search. We round down to the previous
    // half-hour boundary
    var now = Math.round(new Date().getTime()/1000.0);
    var gridStart = (Math.floor(now/1800)) *1800);

    //Now use that to set the start and end times for the search
    var startQuery = mySearch.createQuery("startTime", 3, gridStart);

    // Assume the grid holds two hours worth of programmes
    var endQuery = mySearch.createQuery("startTime", 4, gridStart + 7200);

    // Now set that query
    mySearch.query = startQuery.and(endQuery);

    // Constrain the search to return only those programmes below the current
    // parental rating threshold
    mySearch.addCurrentRatingConstraint();

    // Start the search, getting the first 50 results
    if (mySearch.result.getResults(0, 50)) {
      // All our data is available immediately
      processSearchResults();
    } else {
      // We need to wait.
    }
  }

This approach might be extensible and flexible for the Web developers because they can easily use "createQuery(...)" to construct the querying criteria in a generic way to search programs. That means we don't need worry about how to define various Web APIs for searching different kinds of fields.

However, the downside of this approach is the implementation feasibility on the platform which still needs to implement and enhance the searching capabilities whenever a new program field is added to be considered. This could be an endless job in the long term and might be hard to implement especially when the fields' matrix is getting complicated.

Another approach is applying the DataStore API [1] which lets the third-party apps be responsible for maintaining their own filtering criteria and searching algorithm by using the IndexedDB API. What the apps need to do is to use the DataStore API to keep synchronized with the "programs" data store. That is, the programs in the data store can be managed by a certified System/TV App and the data can be shared as read-only by other third-party apps.

However, one big concern of using DataStore API and IndexedDB API is about the synchronizing performances. That is, whenever the EIT content is updated by the TV broadcaster, the System/TV app has to flush the whole "programs" data store and other third-party apps need to synchronize all the new programs into their local indexed DBs. Assuming the number of programs can be up to 1000000, both the synchronizing performance and the index-updating performance have to be carefully considered.

[1] https://wiki.mozilla.org/WebAPI/DataStore

Updated

4 years ago
Whiteboard: [FT:Stream3] → [ft:conndevices]

Updated

3 years ago
Blocks: 1187806

Updated

3 years ago
No longer blocks: 1187806

Comment 1

10 months ago
Firefox OS is not being worked on
Status: NEW → RESOLVED
Last Resolved: 10 months ago
Resolution: --- → WONTFIX
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.