| ARRIS Enterprises, Inc. Confidential Information |
DVRThe example portal has support for DVR and shows how to use the Media Service. It uses media recorders to start recording, and demonstrates the newly added Content Service for monitoring on-going recordings, managing storage, and performing searches for content.
Content ServiceThe Content Service provides applications with an interface for searching for and managing content from multiple sources. Right now, an attached storage device is the only supported content source, but in future there may be content sources such as OTT video streaming services, DLNA in the home network, NAS, NPVR servers, etc. The actual content, also referred to as content entries, are media files. The exact type depends on the source, but for DVR content sources, each content entry is a recorded video stream. Content entries have attached properties, representing the contents title, duration, URI, description, and others. The exact availablility of properties depends on the type of content source. Custom properties can also be defined and used. A flexible search function allows applications to search for content entries, from one or multiple sources, with a variety of search properties and conditions. The example portal uses the search to return a list of all recorded content from the attached DVR storage device. Content Service also provides events when content sources are added or removed. Right now, this means attaching and detatching a USB storage device, but the service could also cover network disconnections from remote content sources with the same API. The example portal UI is event-driven, meaning that event listener functions are registered for many events, and these functions update the UI when TOI events occur (e.g. when a content entry is created or deleted, TOI invokes the listeners registered for those events, and the listener function drives the UI, creating or removing an element from the HTML). Getting started with Content ServiceThe
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
Event listeners are also added to listen for If some other part of the example portal application, or another content source, could potentially add content in runtime, then the Event listeners are added for
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
When a source becomes available, the portal performs a search for recorded content on it, and adds any found content to the UI. When a source becomes unavailable, the list of content in the UI is emptied, and the source instance is released. Searching for contentWhen the portal first runs, or when a new content source is attached and becomes available, the UI needs to build a list of all of the available content entries. This is done by using the Content Service
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
The Since searching is an asynchronous operation, a The empty functions in Start a recordingThe following steps are required to start a recording:
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
Setting propertiesMetadata, such as a contents title and genre, and any custom properties, can be stored in the content entry with
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
When you want to locate the recording later, perform a search for some or all of these properties. You could use a custom property to indicate whether the user has viewed the recording yet or not. Also, if a user is playing back some recorded content and stops in the middle, you could set a property to contain the viewing position. This would allow you to resume from the same place later. TimeshiftTimeshift is a special-case of DVR. It is started and stopped through the media player API, see the timeshift example for more on that. Since it is a content, the timeshift buffer has a contentId, and a helper function to retrieve it from the media player is available:
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
As the timeshift buffering is stopped on each channel change, and started by another part of the example portal when zapped into a timeshift-capable stream, this starting and stopping generates media recorder state change events, which the DVR portal needs to filter out. Media Recorder Status ChangesAlthough individual media recorder instances can generate state change events for that individual recorder, a single event from the media service also exists to indicate that a state change has occurred on any of the existing recorders. The portal uses this latter event,
<sdk_root>/examples/example-html-portal/modules/dvr/dvr.js
As mentioned above, the timeshift buffering will generate events when recording starts and stops, and these are ignored here. The important thing is that when a new recording begins, the transition to STATE_RECORDING is what drives the change in the UI with the |