Micro Mart - 10 March 2016_

(Nancy Kaufman) #1

Issue 1404 63


CHROMECAST


CodeA WebApp
At launch Chromecast worked natively withYouTube, Netflix
and a few others but, as we mentioned earlier, casting Flash
videos from other websites via the Crome tab cast feature can
result in a poor user experience.To help this situation in February
2014 Google announced the public availability of a Chromecast
application programming interface (API) for developers. In fact
there were three APIs in total, one for Google’s Chrome OS
(version 28+), plus ones for Google Android (version 2.3+) and
Apple iOS (version 6.0+).
Using these APIs developers can now create ‘Sender’ apps
that cast contents directly to the display, bypassing the ‘Google
Cast’ scenario. These apps need a pre-definedreceiver app
that’s hosted by the Chromecast dongle, but you don’t need to
create one of these as Google provide a number ofready-to-go
examples you could employ.


What does creating a Sender app entail?Well, inreality it’s just
a Chrome extension. In other words you just need a small manifest
text file that describes the app, plus some basic HTML, CSS and
JavaScript code. These are combined into a single CRX file (which is
actually just a ZIP file).
The official Google Chromecast Developer site atdevelopers.google.
com/casthas a number of editable app examples, from a simple ‘Hello
World’ to more useful media streaming ones. What’s more, you don’t
need anything special to begin. Any PC will do – whether it’s running
MicrosoftWindows, Mac OS X or just about any flavour of Linux.You
can code with a simple text editor, such as Notepad or vi, or a full
development tool environment if you prefer. Then just downloada
Sender app sample and edit it to make it your own.
A more detailed explanation of the process can be found at
Matthew Fuller’s blog (goo.gl/sArgqC).


CodeASenderApp
As we said above the SDKs also have Android and iOS support.
What this means is that mobile developers can integrate
Chromecast support directly into their Android and iOS
applications, as a so called ‘Sender App’.


A sender app first discovers all the variousreceiver devices
in the area, before it casts content to the one chosen – in this
case it would be the wi-firouter inside the target Chromecast
dongle. During initialisation a smallreceiver code block is sent
to thereceiver device. The app developer can choose which type
of receiver to use for their content. At this point a cast icon
becomes visible in the host mobile app. Click on this icon and
the smartphone or tablet becomes a ‘Cast’remote control. Now
the host app can perform its encoded functionality and display
the results as text, buttons, images and media content directly
on to the big screen.

CodeA ReceiverApp
If you are a more experienced developer you might like to try
coding areceiver app. It’s still an HTML5/CSS/JavaScript app,
but this time it runs on thereceiver device, in other words the
Chromecast dongle itself.
A receiver application does two key tasks. It defines the display
interface for the big-screen content, and it handles message flow
between the sender apps and thereceiver device. These messages
can be general or app-specific.
There are two types ofreceiver app. A Styled Media Receiver is
a pre-builtreceiver application that provides a default media player
user interface for audio and video content. By editing the associated
CSS file you can customise specific elements of this user interface.
If you’d rather have full control then you’ll need to developa
Custom Receiver app. This time you’re free to define the full user
interface and display additional types of content in addition to audio/
video media. For full instructions visit Google’s developer page at
developers.google.com/cast/docs/receiver_apps.
Note that anyone intending to create either a Styled Media
Receiver and Custom Receiver mustregister their application to
receive a unique app identification code. This ID is then used
when making API calls. In addition developers must alsoregister
a Google Cast device in order to enable app uploading.To see
the full details of what’s needed to get your app up and running
visitdevelopers.google.com/cast/docs/registration.

WrappingUp
Straight out of the box the Google Chromecast dongle is great
value for money, and wireless casting is far more convenient than
connecting a long HDMI cable to the back of the TV.
But, as you’ve seen, you can extract even more value from your
£30 purchase. It can do a whole lot more than just stream video
fromYouTube and Netflix, or view browser tabs on the big screen.
Try out a few tricks or develop your own app and thereturn on your
investment just gets better and better.mm

CECStandard
The Consumer Electronics Control (CEC) standard has
two main features. One is to allow HDMI devices to
control each other. The other is the ability to operate
multiple devices with a single remote control handset.
In practice it’s possible to command and control up
to 10 CEC-enabled devices, which are interconnected
via the HDMI interface. These HDMI devices include
computers and DVD players as well as other TVs.
Google uses this standard when communicating with
the TV’s HDMI port via the Chromecast dongle. Once
installed the desktop or mobile computing device acts
as a sophisticated software-driven controller.

There are over 100


Chromecast-enabled games




iCast developer page

Free download pdf