| ARRIS Enterprises, Inc. Confidential Information |
Content Service OverviewThe content service is responsible for providing applications with an interface where content from multiple sources can be searched for, and modified, in a unified way. SourcesInformation about available content sources can be retrieved by calling ToiContentService.getSources() which returns an array of ToiContentService.ToiSourceInfo. The application can also get notified when sources become available or unavailable by listening to the ON_SOURCE_AVAILABLE / ON_SOURCE_UNAVAILABLE events. Each individual source has a globally unique source identifier which is specified in ToiContentService.ToiSourceInfo and should be used whenever an application want to address a particular source. Source typesEach source belongs to a source type. Operations and notifications can be specific for a source type and in such case the content service provides a source type specific interface to be able to support the characteristics of the source. Even though the source type has a specific interface it can be restricted by the capabilities of each individual source. Common to all source type specific interfaces is the possibility for an application to register itself as a listener for notifications about added, removed or changed content on the specific source. Even these notifications can be unsupported by an individual source and the support for it is indicated by the isNotificationSupported flag in ToiContentService.ToiSourceInfo. To get a handle to a specific source; the application has to call the source type specific create method in ToiContentService and pass the source identifier as argument. If a source identifier is not provided, the first available source of that type is returned. Supported source typesCurrently the only source type supported is CONTENT_SOURCE_TYPE_DVR which represents a source that manages content recorded by the KreaTV platform. Access to a source interface of this type is given by the method ToiContentService.createRecordedSourceInstance() which will return an ToiRecordedContentSource. Source propertiesSource properties are defined by the KreaTV platform. Some source properties describe the source while others can be used to instruct the source to format or restrict it's result in a search operation in some way. An example of such a source property is the PROPERTY_SOURCE_MAX_LIMIT which can be used to put a restriction on the number of matching content from the source. ContentContent information is represented by ToiContentService.ToiContent. Each content is identified by a globally unique content identifier. If the content identifier is known; the application can retrieve information about the content by calling ToiContentService.getContent() and provide which properties it wants values for. The result for this operation will Content can also be removed by calling ToiContentService.remove() if the source where the content is stored supports content removal. This support is indicated by the isRemovalSupported flag in ToiContentService.ToiSourceInfo. Content propertiesContent properties are used to describe content. Some content properties are defined by the platform like PROPERTY_CONTENT_TITLE or PROPERTY_CONTENT_DURATION but applications are also free to set their own properties. Properties defined by the platform can either be read-only or writable by applications. If the property is read-only that will be stated in the property description. Properties are set using the ToiContentService.setProperties() function or removed using the ToiContentService.removeProperties() function. However all sources does not support modification of content properties and the support for it is indicated by the isPropertyModificationSupported flag in ToiContentService.ToiSourceInfo. All properties are represented as strings so if the application need to treat the property as some other type it has to be converted. SearchA central part of the content service is the ToiContentService.search() function. It is used to search for matching content based on conditions in the ToiContentService.ToiSearchParameters which is given as argument. Search parametersThe following search parameters have an restrictive effect on the total number of content matches:
When the matching content from a source have been found the following search parameters operates on the source result: Search examplesSearch in all sources for content where the duration is at least one hour but at most two, and include the title and URI in the result:
Search in the first source returned by getSources() after content that does not represent news and retrieve the title and URI. Also sort it based on when it was created and limit the result to 100 entries:
See also: |