Google Cast

16

Transcript of Google Cast

Google CastBy: Simranjit Kour

Agenda

1.Google Cast Introduction

2.Design Checklist

3.Requirement Study

4.Developing App using Google Cast

5.Technical Details

6. Limitations

Google Cast is a technology that enables multi-screen experiencesand lets a user send and control content like video from a small computing devices like a phone, tablet or laptop to a large display device like television

Google Cast allows Android and iOS mobile apps and Chrome web apps to “cast” content - like video, audio, and screen sharing (mirroring) - to Cast-ready devices like a Chromecast

The Google Cast SDK was released on February 3, 2014

4

Google Cast

Whenever a query is run• Directly after a controller action completes, if no exceptions

are thrown• Directly before a transaction is committed.

Example

def album = Album.get(1) album.title = "Change It"def otherAlbums = Album.findAllWhereTitleLike("%Change%") assert otherAlbums.contains(album)

5

Automatic Session Flushing

1.Cast Base:Sender and Receiver both connected to same WiFi network. There are two ways users can start a Cast session:

1. Connect & play: Connect to a Cast receiver before playing content

2. Play & connect: Connect to a Cast receiver while playing content

2.Cast Button:The cast button invokes a menu to connect, control and disconnect

from Cast receivers.3.Cast Menu:The devices menu is shown whenever the cast button is pressed. The

cast menu lets users connect, control and disconnect from Cast receivers.

6

Design Checklist

4.Sender App:When content is casting / playing on a Cast receiver, the user must always be able to control it from the sender app.

5.Receiver App:The devices menu is shown whenever the cast button is pressed. The

cast menu lets users connect, control and disconnect from Cast receivers.

7

Design Checklist

1.Minimum Android SDK version that the Cast SDK supports is 9 (GingerBread)2.The Google Play services library need to be referenced inside the application element.3.Cast application development involves development of Sender and Receiver applications.4.You need to register your application in order to get application ID (which will be used in both “sender” and “receiver” applications).https://cast.google.com/publish/

5. Pay the one time $5 registration fee6. Register your Google Cast device so that it may access your

receiverapplication before you publish it. 8

Requirements

1.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

2.Meta-data element is required in manifest:<meta-data

android:name="com.google.android.gms.version"

android:value="@integer/google_play_services_version" />

3.Application’s theme:android:theme="@style/Theme.AppCompat"

9

Developing Sender App

Developing Sender App

10

4.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>

5.Classes used:MediaRouter

MediaRouteSelecto

r Cast

CastDevice

GoogleApiClien

t

Sender app starts MediaRouter device discovery: MediaRouter.addCallback MediaRouter informs user selected: MediaRouter.Callback.onRouteSelected Sender app retrieves CastDevice instance: CastDevice.getFromBundle Sender app creates a GoogleApiClient: GoogleApiClient.BuilderSender app connects the GoogleApiClient: GoogleApiClient.connect

SDK confirms: GoogleApiClient.ConnectionCallbacks.onConnected Sender app launches the receiver app: Cast.CastApi.launchApplication SDK confirms: ResultCallback<Cast.ApplicationConnectionResult> Creates a communication channel: Cast.CastApi.setMessageReceivedCallbacks

Sender sends a message to the receiver: Cast.CastApi.sendMessage

10

Sender application flow

“Receiver” application is a special form of Web application that can run on a Chromecast device

Functions of Receiver Application:1.Provides an interface to display the app's content.

2.Handles messages from the sender application to control content on the receiver device.3. Handles custom messages from the sender application that

are application-specific

12

Developing Receiver App

1.Styled Media Receiver:Pre-built receiver application hosted by Google that is designed for streamingaudio and video content

2.Custom Receiver:If app provides content such as a game or image gallery, requires DRM, or requires support for media types. It is an HTML5 app that you host on your own servers using the JavaScript Receiver API.

3.Default Media Receiver:It does not require you to register with the Google Cast SDK Developer Console, but you cannot customize any of the UI.

CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID

13

Types of Receiver Application

1.Use same WiFi network for both sender and receiver device2.Supported Image formats : BMP, GIF, JPEG, PNG, WEBP3.Supported Audio formats: MP3, Vorbis, Wav4.Streaming protocols: MP4, WebM5.Media Player Library supported types: PlayReady, Widevine6.Optimized android apps: Youtube, Netflix, Google Music, Google Movies7.Download the Google Cast Extension for Crome browser: https://chrome.google.com/webstore/detail/google-cast/

14

Technical Details

1.The Cast device is a low-power device with memory, CPU, and GPUlimitations, so the receiver application should be as lightweight as possible

2.Tabs, windows or popups cannot be created in the receiver app, and there should be nothing on the receiver device screen requiring input. All interaction with the application must be done through a sender application3.Only one video element may be active at any time4.Video compositing, manipulation, transformations, rotations or zooming

arenot supported

15

Limitations

Contact us

Our Office

Client Location

Here’s how TOTHENEW uses GoogleCast for MOBILITY!

Click Here To Know More!

Have more queries on MOBILITY?

Talk To Our Experts