Google Cast is an emerging technology that enables a multi-screen experience to users. It is a screen-sharing technology that allows users to send and control content from their computing devices such as laptops, tablets and smartphones to their TVs screens.
In this blog, we will take you through few steps to begin with the Cast session. The important point to remember is that when you are about to begin the Cast session, both the sender’s and receiver’s devices should be connected to the same WiFi.
There are two ways users can start a Cast session:
1. Connect & Play: As the name suggests, one needs to connect to the Cast receiver first before playing the content.
2. Play & Connect: In this the content gets played first and the user connects to the Cast receiver later.
1. Minimum Android SDK version that the Cast SDK supports is 9 (GingerBread)
2. Cast application development involves development of Sender and Receiver applications.
3. Package require: com.google.android.gms.cast
4. You need to register your application in order to get application ID (which will be used in both “sender” and “receiver” applications).
5. Register your Google Cast device so that it may access your receiver application before you publish it.
6. It can take up to 6 hours to publish your receiver app.
Developing Sender App:
1. Classes used:
2. Create empty Android application and add the following libraries as dependencies:
android-sdk\extras\android\support\v7\appcompat android-sdk\extras\android\support\v7\mediarouter android-sdk\extras\google\google_play_services\libproject\google-play-services_lib
3. meta-data element is required in Manifest:
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
4. Application’s theme:
5. Adding the Cast Button:
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/media_route_menu_item" android:title="@string/media_route_menu_title" app:actionProviderClass="android.support.v7.app.MediaRouteActionProvider" app:showAsAction="always"/> </menu>
Developing Receiver App:
Chromecast is the device which can run the special form of Web Application called “Receiver”
Functions of Receiver Application:
1. An interface to display the app’s content is provided.
2. To control the content (messages) on the receiver device from the sender application.
3. It handles custom messages from the sender application that are application-specific
Types of Receiver Application:
1. Custom Receiver:
2. Styled Media Receiver:
Google hosted a Pre-built receiver application which is designed for streaming audio and video content.
3. Default Media Receiver:
You don’t have to register with the Google Cast SDK Developer Console, and you cannot customise any of the UI.
Default Media Reciever ID:
1. Same WiFi network is to be used for both sender and receiver device.
2. Media Player Library supported types: PlayReady, Widevine.
3. Optimized android apps: Youtube, Netflix, Google Music, Google Movies.
4. Audio formats that support are MP3, Vorbis, Wav.
5. Streaming protocols: MP4, WebM are validated.
6. Image formats that support are BMP, GIF, JPEG, PNG, WEBP.
7. Download the Google Cast Extension for Crome browser.
1. Cast Device is with memory, CPU and GPU limitations and it is also a low-power device so the receiver application.
2. In Receiver app we cannot create Tabs, windows or popups, and there should be nothing on the receiver device screen requiring input. All the interaction is to be done through a sender application.
3. Only one video will be active at a time.
4. Video compositing, manipulation, transformations, rotations or zooming are not supported.
Hope this was useful to the readers.
Happy Casting !!!