Developing on the H5 platform allows several additional features in comparison to your desktop browser, due to the architecture of your session running in the cloud. There are a few nearly-transparent methods available to the developer which minimize the gap between testing in Chrome and deploying to the H5 platform. For example: how to send a message to the client device; how to launch an application that is resident on the device (VOD, RTSP stream, etc.); and how to determine the client device identifier needed for integration-specific APIs such as loading a user's favorite channels from a database.
Accessing the Client ID
The device ID of the client is sent by the CloudTV client living on the device, and persists from session to session unless the non-volatile memory on the device is flashed (such as during the return process or when refurbished). A small extension to the navigator agent is available that contains this client-specific information, as shown below.
Communicating With The Client
In CloudTV, the client is a thin software layer that runs on the user device. This may be a Blu-ray player, a Motorola set top box, or a Television — each can accept commands from your application.
Telling The Client to Tune Away
If the client device is a cable box, it contains additonal software agents. The CloudTV client can communicate with these agents in a handoff (or handover) that ends the CloudTV session and starts up another agent on the device with the parameters provided. Some examples are:
- vod://pid/aid (open up the agent which registered the vod:// protocol on the device and pass in pid and aid)
- rtsp://10.230.101.120:444 (open up the agent which registered the rtsp:// protocol and pass in the IP and port of the RTSP stream)
- info://pid/aid (open up the agent which registered the info:// protocol on the device and pass in pid and aid)
- tv://123 (tune to channel 123)
- tv://650 (tune to channel 650)
Playing a Video Stream
In H5, the HTML5 <video> element is used for all video behavior that is run from within the application. As such, the only requiremnt to play video from a source that is not a file is that you know how to access it and that the video is in a format which can be played back by the H5 streaming engine. This might be a single MP4 file, or a UDP stream from a scalar. The implementation in your application is exactly the same.
Example of Loading a video and a UDP stream: