| ARRIS Enterprises, Inc. Confidential Information |
Media PlayerHTML
The <sdk_root>/examples/example-html-portal/index.html
KreaTV supports standard HTML5 video tags. To play different streams, the JavaScript in the page needs to change the
In addition to the standard behavior, KreaTV also allows much more powerful and flexible control over media playing than that offered just through the To take advantage of these features, the first thing to do is note the special use of the TOI media player initialization<sdk_root>/examples/example-html-portal/media.js
Control and communication with the hardware media player is done through an instance of the media player in the portal. During initialization, the portal asks the Media Service for an instance of the media player with the
Registering listenersThe TOI API is asynchronous and event-driven. When some notible thing occurs, such as the currently playing stream reaching its end, an event is generated. The portal application can register a listener function for this specific event identifier. The KreaTV platform calls the listener function, passing some details about the specific event as an argument to that listener function. You can find more info on events on the Asynchronous operations page.
Here, the example portal registers a listener function for
<sdk_root>/examples/example-html-portal/media.js
It is possible for other parts of the portal to also register listener functions on the same event, in the same way. You will see this technique in use throughout the example portal. An error message component registers an event to watch for the media player changing into a failed state. Similarly, the power management service registers listeners to know when the media player cleanly shuts down, before putting the STB into standby. You can find a lot more information about media players, and media player state changes on the Media Service page. |