iOS mobile apps and Chrome web apps to “cast” content - like video, audio, and screen sharing (mirroring) - to Cast-ready devices like Google ChromeCast. The sender may be a phone or tablet running on Android or iOS, or it may be a laptop computer running Chrome. The receiver device is optimized for video playback with a receiver application that receives data over Internet Protocol and transmits it to the television. www.letsnurture.com | www.letsnurture.co.uk
laptop is the sender which controls the playback, and the TV is the receiver which displays the content. All the user interaction and most of the user interface takes place on the sender device rather than on the TV. Note: Both Should be on same Wi-Fi www.letsnurture.com | www.letsnurture.co.uk
ChromeCast device. 3) Run the ChromeCast app on sender device. 4) Under Privacy, check the box to "Send this ChromeCast's serial number when checking for updates". - To start development you need to register your device. By default It is not enable for Development. www.letsnurture.com | www.letsnurture.co.uk
Integrate ChromeCast in your app. Sender Application & Receiver Application:- -> Register your application. Than You will get 1 AppID for development. This AppID is use to configure Custom Receiver / Styled Media Receiver. www.letsnurture.com | www.letsnurture.co.uk
to your CSS file located on your own web site or on Google Drive .background { background: center no-repeat url(background.png); } .logo { background-image: url(logo.png); } .progressBar { background-color: rgb(238, 255, 65); } .splash { background-image: url(splash.png); } .watermark { background-image: url(watermark.png); background-size: 57px 57px; } www.letsnurture.com | www.letsnurture.co.uk
an application. Now you have to develop sender Application. You need to use same App ID which we have created previously in Sender Application. www.letsnurture.com | www.letsnurture.co.uk
MediaRouter allows applications to control the routing of media channels and streams from the current device to destination devices. www.letsnurture.com | www.letsnurture.co.uk
discovery: MediaRouter.addCallback • MediaRouter informs sender app of the route the user selected: MediaRouter.Callback.onRouteSelected • Sender app retrieves CastDevice instance: CastDevice.getFromBundle • Sender app creates a GoogleApiClient: GoogleApiClient.Builder • Sender app connects the GoogleApiClient: GoogleApiClient.connect • SDK confirms that GoogleApiClient is connected: GoogleApiClient.ConnectionCallbacks.onConnected • Sender app launches the receiver app: Cast.CastApi.launchApplication • SDK confirms that the receiver app is connected: ResultCallback<Cast.ApplicationConnectionResult> • Sender app creates a communication channel: Cast.CastApi.setMessageReceivedCallbacks • Sender sends a message to the receiver over the communication channel: Cast.CastApi.sendMessage www.letsnurture.com | www.letsnurture.co.uk
using the Android MediaRouter APIs in the Android Support Library, with compatibility back to Android 2.1. The MediaRouter ActionBar provider needs to be added to the application’s menu hierarchy defined in XML. @Override public boolean onCreateOptionsMenu(Menu menu) { MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item); MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem); mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector); return true; } mMediaRouteSelector = new MediaRouteSelector.Builder() .addControlCategory(CastMediaControlIntent.categoryForCast("YOUR_APPLICATION_ID")) .build(); www.letsnurture.com | www.letsnurture.co.uk
the user selected, the sender application can launch the receiver application on that device. Media channel: The Google Cast SDK supports a media channel to play media on a receiver application. mRemoteMediaPlayer = new RemoteMediaPlayer(); MediaInfo mediaInfo = new MediaInfo.Builder( "http://your.server.com/video.mp4") .setContentType("video/mp4") .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED) .build(); mRemoteMediaPlayer.load(mApiClient, mediaInfo, true) ;