SlideShare a Scribd company logo
1 of 44
Download to read offline
THE UNCONVENTIONAL DEVICES
FOR THE VIDEO STREAMING
IN ANDROID
a.martellucci[at]reply.it
@martellux
+AlessandroMartellucci
m.bonifazi[at]reply.it
@mbonifazi
+MatteoBonifazi
Who We Are
Who We Are
our books
Sviluppare applicazioni per Android
in 7 giorni
Android
Programmazione Avanzata
Coming soon!
•  Reply is today a leading IT Services Company, which operates in Italy, Germany, UK,
Benelux, USA and Brazil.
•  Open Reply is the company of Reply Group focused on open source software,
multichannel web solutions and mobile applications.
•  Based in Rome, our team is based a young team of over 40 engineers 100% focused on
mobile development (iOS, Android & Windows Phone).
•  We are specialised in broadcasting, banking and Android OS Customisation.
Open Reply
Engage users through streaming app
*http://www.nielsen.com/us/en/insights/reports/2014/shifts-in-viewing-the-cross-platform-report-q2-2014.html
+53%
+80%
+60%
-1% -1% -2%
18/34 35/49 50/64 Ages
Engage users through streaming app
q  In US more than 2 milion people watched last World Cup by a mobile App.1
q  270% increase in online video watched by smartphone and tablet.2
q  More than one bilion tap on Google Chromecast cast button.3
q  YouTube viewer habits prove “the bigger the screen, the longer people watch.”4
1)WatchESPN app access 2)Nielsen Q3 ‘14 Total Audience report 3) Google’s Omid Kordestani interview 2015 4) Youtube usage internal analysis.
q  Playing a video content on your handheld device.
q  Streaming taiolered for the user with
q  Easiest way to enjoy video and music on user TV with
Presentation Millestone
Android multimedia framework
Android support for playing several media types from media file stored inside the application
(raw resources, standalone files) or for OTT streaming.
*Camera, foto rendering and other media type are managed by it but they are out of scope for this talk.
Network Protocols
RTSP (RTP, SDP)
HTTP/HTTPS progressive streaming
HTTP/HTTPS live streaming
Dynamic adaptive streaming over HTTP (DASH)
Smooth Streaming
Core Media Formats
H.263 ->3GPP(.3gp),MPEG-4(.mp4)
H.264 AVC -> 3GPP(.3gp),MPEG-4(.mp4),MPEG-TS(.ts)
MPEG-4 SP -> 3GPP(.3gp)
VP8 -> WebM(.webm),Matroska(.mkv)
Note. Any given mobile device may provide support for additional formats or file types not listed in the table.
Android multimedia framework documentation
50% Android multimedia framework questions are unaswered on Stackoverflow
//1. Find the view from the layout
VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview);
//2. Setup video url
myVideoView.setVideoURI(Uri.parse(SrcPath));
//3. Setup Video controller
myVideoView.setMediaController(new MediaController(this));
//4. Start playing
myVideoView.requestFocus();
myVideoView.start();
VideoView.java
Media Playback 1/2
//0. Get SurfaceView and its holder
mPreview = (SurfaceView)findViewById(R.id.surfaceView);
holder = mPreview.getHolder();
mp = new MediaPlayer(); //1. Create MediaPlayer object:
//2. Add SurfaceHolder callback - Aware when SurfaceView is created
holder.addCallback(new SurfaceHolder.Callback(){ ....
@Override
public void surfaceCreated(SurfaceHolder holder) {
mp.setDisplay(holder); //3. Attach the surface to the player
try {
mp.setDataSource(filepath);
//4. Prepare the Mediaplayer in sync or async mode ( prepareAsync() )
mp.prepare();
} catch (Exception e) {// Catch the exception}
mp.start(); //5. Start the player }...
});
MediaPlayer.java
Media Playback 2/2
ExoPlayer
ExoPlayer is a media player built on top of the MediaExtractor and MediaCodec APIs released
in Android 4.1 (API level 16).
ExoPlayer provides default TrackRenderer implementations for audio and video, which make
use of the MediaCodec and AudioTrack classes in the Android framework.
During playback, your app can listen for events generated by the ExoPlayer that indicates the
overall state of the player (ExoPlayer.Listener).
player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, minBuffer, maxBuffer);
// 2. Construct renderers.
DataSource dataSource = new UriDataSource(userAgent, bandwidthMeter);
HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter, null,
HlsChunkSource.ADAPTIVE_MODE_SPLICE);
HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, true, 3);
MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource,
MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(), player, 50);
MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource);
player.prepare(videoRenderer, audioRenderer); // 3. Inject the renderers through prepare.
player.setSurface(surfaceView.getHolder().getSurface()); // 4. Pass the surface to the video renderer.
player.setPlayWhenReady(true); // 5. Start playback
…
…
player.release(); // Release when everything is done!
ExoPlayer.java
ExoPlayer – HLS implementation
What next?
q  Built-in players
ü  AwesomePlayer (default player selected)
ü  NuPlayer (Apple HLS)
q  Extra player factories can be registered
q  DIY mediaplayer
ü  Demuxing: android.media.mediaExtractor
ü  Decoding: android.media.MediaCodec
ü  Video rendering: android.media.MediaCodec
ü  Audio rendering: android.media.AudioTrack
ü  Implement the interfaceframeworks/av/include/media/MediaPlayerInterface.h
Android TV
Android TV is Android!!!
Smartphone 5”
320 dp
TV Full HD 30”
320 dp
10 feet
16 inches
10 foot experience
Keep calm and lean back!!
Provides built-in tailored for 10 feet experience
<uses-feature android:name="android.software.leanback"
android:required="true" />
<application
android:allowBackup="false”
android:label="@string/app_name”
android:theme="@style/Theme.Leanback" >
<activity
android:name="MainActivity”
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
AndroidManifest.xml
Android Manifest features1/2
Android Manifest features 2/2
Supporting landscape orientation is mandatory
No touch screen is required
<uses-feature android:name="android.hardware.sensor.accelerometer”
android:required="false" />
<uses-feature android:name="android.hardware.touchscreen” android:required="false"/>
<activity android:name=”AndroidTvActivity” android:screenOrientation="landscape" >
Limit your sensor! Your app doesn’t need to accelerate!!!
Leanback UI component – BroswerFragment
Leanback UI component – DetailFragment
Building Live TV Apps
TV Input Framework provides a unified method for receiving audio and
video channel content from hardware sources and software sources.
Android 5.0 (API level 21) or higher
TV Provider manages all EPG info, meanwhile TV Input Manager handles
streaming contents.
TV Input Manager
<service android:name=”droidcon.it.DroidconTvInputService"
android:label="@string/sample_tv_input_label"
android:permission="android.permission.BIND_TV_INPUT">
<intent-filter>
<action android:name="android.media.tv.TvInputService" />
</intent-filter>
<meta-data android:name="android.media.tv.input"
android:resource="@xml/sample_tv_input" />
</service>
onTune() event is fired when user selects a channel, and notifies the
system TV app for changes in the content and meta data.
TvInputService creates a TvInputService.Session that implements
Handler.Callback to handle player state changes.
TV provider
<uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" />
<uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" />
Tv Channel
COLUMN_DESCRIPTION
COLUMN_DISPLAY_NAME
COLUMN_DISPLAY_NUMBER
COLUMN_INPUT_ID
COLUMN_SERVICE_TYPE
COLUMN_TRANSPORT_STREAM_ID
COLUMN_TYPE
COLUMN_INTERNAL_PROVIDER_DATA
COLUMN_NETWORK_AFFILIATION
COLUMN_ORIGINAL_NETWORK_ID
COLUMN_SEARCHABLE
COLUMN_SERVICE_ID
COLUMN_VERSION_NUMBER
COLUMN_VIDEO_FORMAT
Tv Program
COLUMN_LONG_DESCRIPTION
COLUMN_POSTER_ART_URI
COLUMN_SEASON_NUMBER
COLUMN_SHORT_DESCRIPTION
COLUMN_START_TIME_UTC_MILLIS
COLUMN_THUMBNAIL_URI
COLUMN_TITLE
COLUMN_VERSION_NUMBER
COLUMN_VIDEO_HEIGHT
COLUMN_VIDEO_WIDTH
COLUMN_AUDIO_LANGUAGE
COLUMN_BROADCAST_GENRE
COLUMN_CANONICAL_GENRE
COLUMN_CHANNEL_ID
COLUMN_CONTENT_RATING
COLUMN_END_TIME_UTC_MILLIS
COLUMN_EPISODE_NUMBER
COLUMN_EPISODE_TITLE
COLUMN_INTERNAL_PROVIDER_DATA
A basic database of TV content metadata such as channel and program information.
Manifest permission:
Chromecast
a cast-ready device for multi-screen experience
source: www.google.it
Chromecast
some numbers
•  10 million units sold
•  1 billion times for Cast button
•  300+ apps on Play Store
•  6000 developers on 10000 apps
Chromecast
components
•  Google Cast technology
•  Multi-Screen experiece
•  Google Cast SDK
•  Sender Application
•  Android app
•  iOS app
•  Chrome app
•  Receiver Application
•  Default Media Receiver
•  Styled Media Receiver
•  Custom Media Receiver
Android Client Application
library dependencies
•  Minimum SDK version supported by Google Cast is 9 (Gingerbread)
•  MediaRouter API of android-support-v7
•  Google Play Services
•  AppCompat API of android-support-v7
Android Client Application
typical sender application flow
•  Sender app starts MediaRouter device 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 and uses GoogleApiClient: GoogleApiClient.Builder
•  Sender app launches the receiver app: Cast.CastApi.launchApplication
•  Sender app creates a communication channel: Cast.CastApi.setMessageReceivedCallbacks
•  Sender sends a message to the receiver over the communication channel: Cast.CastApi.sendMessage
source: developers.google.com
Cast-Ready Device Discovery
capabilities
Remote	
  Playback	
  
Live	
  Audio	
   Live	
  Video	
  
MediaRouteSelector.Builder builder = new MediaRouteSelector.Builder();
builder.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO);
builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO);
MediaRouterSelector selector = builder.build();
MainAc'vity.java	
  
Media Cast Button
easy approach for discovering
source: developers.google.com source: developers.google.com
public boolean onCreateOptionsMenu(Menu menu) {
MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item);
MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider)
MenuItemCompat.getActionProvider(mediaRouteMenuItem);
mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector);
}
MainAc'vity.java	
  
RemoteMediaPlayer
…finally
MediaInfo mediaInfo = new MediaInfo.Builder("http://your.server.com/video.mp4")
.setContentType("video/mp4")
.setStreamType(MediaInfo.STREAM_TYPE_BUFFERED)
.setMetadata(mediaMetadata)
.build();
…
mRemoteMediaPlayer = new RemoteMediaPlayer();
mRemoteMediaPlayer.load(mApiClient, mediaInfo, true);
…
MainAc'vity.java	
  
Receiver Application
powered by Chrome
What is?
HTML5 and Javascript application
What does?
Display the media content on TV
Message handling
Which type?
Default	
  Media	
  Receiver	
  
Styled	
  Media	
  Receiver	
   Custom	
  Media	
  Receiver	
  
source: unknow
Default Media Receiver
simplest
•  Off-the-shelf
•  No UI customization
•  No registration
Source: developers.google.com
Styled Media Receiver
simple and customizable
•  Similar to Default Media Player
•  CSS UI customization
•  Registration
Source: developers.google.com
Custom Media Receiver
whatever you want
•  Fully Web Applicaiton
•  Debug(able) at 9222
•  Registration
Source: developers.google.com
Custom Media Receiver
basic example
<html>
<head>
  <title>Example minimum receiver</title>
<script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script>
</head>
<body>
<video id='media'/>
<script>
window.mediaElement = document.getElementById('media');
window.mediaManager = new cast.receiver.MediaManager(window.mediaElement);
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
window.castReceiverManager.start();
</script>
</body>
</html>
Index.htm	
  
Custom Media Receiver
advanced features
•  Video Codification/Decodification
•  H.264 High Profile Level 4.1, 4.2 and 5
•  VP8
•  Adaptive Bitrate Streaming
•  HTTP Live Streaming (HLS)
•  Dynamic Adaptive Streaming over HTTP (MPEG-DASH)
•  Smooth Streaming
•  Digital Rights Management
•  Play Ready DRM
•  Widevine DRM
•  Media Player Library
Custom Media Receiver
advanced example
Index.htm	
  
<html>
<head>
<script
src="//www.gstatic.com/cast/sdk/libs/mediaplayer/1.0.0/media_player.js" />
</head>
<body>
<script type="text/javascript">
window.defaultOnLoad = mediaManager.onLoad;
mediaManager.onLoad = function (event) {
if (window.player !== null) {
player.unload();
window.player = null;
}
Custom Media Receiver
advanced example
if (event.data['media'] && event.data['media']['contentId']) {
var url = event.data['media']['contentId'];
window.host = new cast.player.api.Host({'mediaElement':mediaElement, 'url':url});
var ext = url.substring(url.lastIndexOf('.'), url.length);
var startAt = event.data['media']['currentTime'] || 0;
var autoplay = event.data['autoplay'] || true;
var protocol = null;
mediaElement.autoplay = autoplay;
if (url.lastIndexOf('.m3u8') >= 0) {
protocol = cast.player.api.CreateHlsStreamingProtocol(host);
} else if (url.lastIndexOf('.mpd') >= 0) {
protocol = cast.player.api.CreateDashStreamingProtocol(host);
} else if (url.indexOf('.ism/') >= 0) {
protocol = cast.player.api.CreateSmoothStreamingProtocol(host);
}
Index.htm	
  
Custom Media Receiver
advanced example
host.onError = function(errorCode) {
if (window.player) {
window.player.unload();
window.player = null;
}
};
if (protocol !== null) {
window.player = new cast.player.api.Player(host);
window.player.load(protocol, startAt);
} else {
window.defaultOnLoad(event);
}
}
}
window.player = null;
window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance();
castReceiverManager.start();
Index.html	
  
Resources
•  Google Cast: https://developers.google.com/cast
•  Chromecast App: http://www.google.it/chrome/devices/chromecast/apps.html
•  Google Cast Downloads: https://developers.google.com/cast/docs/downloads
•  Github: https://github.com/googlecast
•  Android TV: https://developer.android.com/tv
•  Android TV Apps: http://www.google.it/chrome/devices/chromecast/apps.html
•  Android TV codelab: g.co/dev/codelab-androidtv
•  Github Leanback: https://github.com/googlesamples/androidtv-Leanback.git
Enjoy the video
thank you to all of you
Source: www.huffingtonpost.ca
+MatteoBonifazi +AlessandroMartellucci
@mbonifazi @martellux

More Related Content

What's hot

The unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidThe unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidAlessandro Martellucci
 
Youtube api at Glance
Youtube api at GlanceYoutube api at Glance
Youtube api at GlanceAshok Basnet
 
Android Workshop
Android WorkshopAndroid Workshop
Android WorkshopJunda Ong
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackSunita Singh
 
Skinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsSkinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsVIA Embedded
 
Applications Development
Applications DevelopmentApplications Development
Applications DevelopmentThe Sapper UAE
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear DevelopmentJohnny Sung
 
Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Chris Griffith
 
Introduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backendIntroduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backendJoseluis Laso
 
Google Maps API for Android
Google Maps API for AndroidGoogle Maps API for Android
Google Maps API for AndroidMaksim Golivkin
 
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TVBeMyApp
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5Roy Clarkson
 
Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Chris Griffith
 
Google teams up with ubuntu to bring linux desktop app support to flutter
 Google teams up with ubuntu to bring linux desktop app support to flutter Google teams up with ubuntu to bring linux desktop app support to flutter
Google teams up with ubuntu to bring linux desktop app support to flutterKaty Slemon
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKitLouis D'hauwe
 
Flash Platform for Devices
Flash Platform for DevicesFlash Platform for Devices
Flash Platform for DevicesSerge Jespers
 
Extending Spring MVC with Spring Mobile and JavaScript
Extending Spring MVC with Spring Mobile and JavaScriptExtending Spring MVC with Spring Mobile and JavaScript
Extending Spring MVC with Spring Mobile and JavaScriptRoy Clarkson
 
Android OS - The Journey of most popular Operating System
Android OS - The Journey of most popular Operating SystemAndroid OS - The Journey of most popular Operating System
Android OS - The Journey of most popular Operating SystemSingsys Pte Ltd
 

What's hot (20)

The unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in AndroidThe unconventional devices for the video streaming in Android
The unconventional devices for the video streaming in Android
 
Youtube api at Glance
Youtube api at GlanceYoutube api at Glance
Youtube api at Glance
 
Android Workshop
Android WorkshopAndroid Workshop
Android Workshop
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and Jetpack
 
Skinning Android for Embedded Applications
Skinning Android for Embedded ApplicationsSkinning Android for Embedded Applications
Skinning Android for Embedded Applications
 
Applications Development
Applications DevelopmentApplications Development
Applications Development
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
 
Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5
 
Introduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backendIntroduction to Titanium and how to connect with a PHP backend
Introduction to Titanium and how to connect with a PHP backend
 
Google Maps API for Android
Google Maps API for AndroidGoogle Maps API for Android
Google Maps API for Android
 
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
[Ultracode Munich Meetup #7] Building Apps for Nexus Player & Android TV
 
Mobile Web Development with HTML5
Mobile Web Development with HTML5Mobile Web Development with HTML5
Mobile Web Development with HTML5
 
Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5
 
Google teams up with ubuntu to bring linux desktop app support to flutter
 Google teams up with ubuntu to bring linux desktop app support to flutter Google teams up with ubuntu to bring linux desktop app support to flutter
Google teams up with ubuntu to bring linux desktop app support to flutter
 
Your First Adobe Flash Application for Android
Your First Adobe Flash Application for AndroidYour First Adobe Flash Application for Android
Your First Adobe Flash Application for Android
 
Introducing PanelKit
Introducing PanelKitIntroducing PanelKit
Introducing PanelKit
 
Flash Platform for Devices
Flash Platform for DevicesFlash Platform for Devices
Flash Platform for Devices
 
Extending Spring MVC with Spring Mobile and JavaScript
Extending Spring MVC with Spring Mobile and JavaScriptExtending Spring MVC with Spring Mobile and JavaScript
Extending Spring MVC with Spring Mobile and JavaScript
 
Android OS - The Journey of most popular Operating System
Android OS - The Journey of most popular Operating SystemAndroid OS - The Journey of most popular Operating System
Android OS - The Journey of most popular Operating System
 
Ionic2 First Lesson of Four
Ionic2 First Lesson of FourIonic2 First Lesson of Four
Ionic2 First Lesson of Four
 

Similar to The unconventional devices for the Android video streaming

viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...Ted Chien
 
Google Wave API: Now and Beyond
Google Wave API: Now and BeyondGoogle Wave API: Now and Beyond
Google Wave API: Now and BeyondMarakana Inc.
 
WebRTC Standards & Implementation Q&A - All about browser interoperability
WebRTC Standards & Implementation Q&A - All about browser interoperabilityWebRTC Standards & Implementation Q&A - All about browser interoperability
WebRTC Standards & Implementation Q&A - All about browser interoperabilityAmir Zmora
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindiappsdevelopment
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorialSynapseindiappsdevelopment
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android OKirill Rozov
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemPrasannPatel4
 
LIB 114 Emerging Technologies 2011
LIB 114 Emerging Technologies 2011LIB 114 Emerging Technologies 2011
LIB 114 Emerging Technologies 2011bthat
 
Developing applications with Kurento
Developing applications with KurentoDeveloping applications with Kurento
Developing applications with KurentoLuis Lopez
 
Apache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseApache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseHao Chen
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web DesignChristopher Schmitt
 

Similar to The unconventional devices for the Android video streaming (20)

Integrando sua app Android com Chromecast
Integrando sua app Android com ChromecastIntegrando sua app Android com Chromecast
Integrando sua app Android com Chromecast
 
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
viWave Study Group - Introduction to Google Android Development - Chapter 23 ...
 
Building Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQLBuilding Streaming Applications with Streaming SQL
Building Streaming Applications with Streaming SQL
 
Kurento cpmx
Kurento cpmxKurento cpmx
Kurento cpmx
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
Google Wave API: Now and Beyond
Google Wave API: Now and BeyondGoogle Wave API: Now and Beyond
Google Wave API: Now and Beyond
 
WebRTC Standards & Implementation Q&A - All about browser interoperability
WebRTC Standards & Implementation Q&A - All about browser interoperabilityWebRTC Standards & Implementation Q&A - All about browser interoperability
WebRTC Standards & Implementation Q&A - All about browser interoperability
 
Synapseindia android application development tutorial
Synapseindia android application development tutorialSynapseindia android application development tutorial
Synapseindia android application development tutorial
 
Synapseindia android apps development tutorial
Synapseindia android apps  development tutorialSynapseindia android apps  development tutorial
Synapseindia android apps development tutorial
 
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
WSO2 Product Release Webinar: WSO2 Complex Event Processor 4.0
 
Android For All The Things
Android For All The ThingsAndroid For All The Things
Android For All The Things
 
What's new in Android O
What's new in Android OWhat's new in Android O
What's new in Android O
 
Internet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking SystemInternet of Things: Vehicular Tracking System
Internet of Things: Vehicular Tracking System
 
Stmik bandung
Stmik bandungStmik bandung
Stmik bandung
 
LIB 114 Emerging Technologies 2011
LIB 114 Emerging Technologies 2011LIB 114 Emerging Technologies 2011
LIB 114 Emerging Technologies 2011
 
Developing applications with Kurento
Developing applications with KurentoDeveloping applications with Kurento
Developing applications with Kurento
 
Apache Eagle: Secure Hadoop in Real Time
Apache Eagle: Secure Hadoop in Real TimeApache Eagle: Secure Hadoop in Real Time
Apache Eagle: Secure Hadoop in Real Time
 
Apache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San JoseApache Eagle at Hadoop Summit 2016 San Jose
Apache Eagle at Hadoop Summit 2016 San Jose
 
[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design[rwdsummit2012] Adaptive Images in Responsive Web Design
[rwdsummit2012] Adaptive Images in Responsive Web Design
 
Scmad Chapter13
Scmad Chapter13Scmad Chapter13
Scmad Chapter13
 

More from Matteo Bonifazi

Invading the home screen
Invading the home screenInvading the home screen
Invading the home screenMatteo Bonifazi
 
Engage user with actions
Engage user with actionsEngage user with actions
Engage user with actionsMatteo Bonifazi
 
Kotlin killed Java stars
Kotlin killed Java starsKotlin killed Java stars
Kotlin killed Java starsMatteo Bonifazi
 
Firebase-ized your mobile app
Firebase-ized  your mobile appFirebase-ized  your mobile app
Firebase-ized your mobile appMatteo Bonifazi
 
Android - Displaying images
Android - Displaying imagesAndroid - Displaying images
Android - Displaying imagesMatteo Bonifazi
 
Android - Background operation
Android - Background operationAndroid - Background operation
Android - Background operationMatteo Bonifazi
 
The Firebase tier for your mobile app - DevFest CH
The Firebase tier for your mobile app - DevFest CHThe Firebase tier for your mobile app - DevFest CH
The Firebase tier for your mobile app - DevFest CHMatteo Bonifazi
 
Engage and retain users in the android world - Droidcon Italy 2016
Engage and retain users in the android world - Droidcon Italy 2016Engage and retain users in the android world - Droidcon Italy 2016
Engage and retain users in the android world - Droidcon Italy 2016Matteo Bonifazi
 
UaMobitech - App Links and App Indexing API
UaMobitech - App Links and App Indexing APIUaMobitech - App Links and App Indexing API
UaMobitech - App Links and App Indexing APIMatteo Bonifazi
 
Google IO - Five months later
Google IO - Five months laterGoogle IO - Five months later
Google IO - Five months laterMatteo Bonifazi
 

More from Matteo Bonifazi (16)

Invading the home screen
Invading the home screenInvading the home screen
Invading the home screen
 
Engage user with actions
Engage user with actionsEngage user with actions
Engage user with actions
 
Kotlin killed Java stars
Kotlin killed Java starsKotlin killed Java stars
Kotlin killed Java stars
 
Android JET Navigation
Android JET NavigationAndroid JET Navigation
Android JET Navigation
 
Firebase-ized your mobile app
Firebase-ized  your mobile appFirebase-ized  your mobile app
Firebase-ized your mobile app
 
Backendless apps
Backendless appsBackendless apps
Backendless apps
 
Android - Saving data
Android - Saving dataAndroid - Saving data
Android - Saving data
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
Android - Displaying images
Android - Displaying imagesAndroid - Displaying images
Android - Displaying images
 
Android - Background operation
Android - Background operationAndroid - Background operation
Android - Background operation
 
Android things intro
Android things introAndroid things intro
Android things intro
 
The Firebase tier for your mobile app - DevFest CH
The Firebase tier for your mobile app - DevFest CHThe Firebase tier for your mobile app - DevFest CH
The Firebase tier for your mobile app - DevFest CH
 
Engage and retain users in the android world - Droidcon Italy 2016
Engage and retain users in the android world - Droidcon Italy 2016Engage and retain users in the android world - Droidcon Italy 2016
Engage and retain users in the android world - Droidcon Italy 2016
 
UaMobitech - App Links and App Indexing API
UaMobitech - App Links and App Indexing APIUaMobitech - App Links and App Indexing API
UaMobitech - App Links and App Indexing API
 
Google IO - Five months later
Google IO - Five months laterGoogle IO - Five months later
Google IO - Five months later
 
Enlarge your screen
Enlarge your screenEnlarge your screen
Enlarge your screen
 

Recently uploaded

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

The unconventional devices for the Android video streaming

  • 1. THE UNCONVENTIONAL DEVICES FOR THE VIDEO STREAMING IN ANDROID
  • 3. Who We Are our books Sviluppare applicazioni per Android in 7 giorni Android Programmazione Avanzata Coming soon!
  • 4. •  Reply is today a leading IT Services Company, which operates in Italy, Germany, UK, Benelux, USA and Brazil. •  Open Reply is the company of Reply Group focused on open source software, multichannel web solutions and mobile applications. •  Based in Rome, our team is based a young team of over 40 engineers 100% focused on mobile development (iOS, Android & Windows Phone). •  We are specialised in broadcasting, banking and Android OS Customisation. Open Reply
  • 5. Engage users through streaming app *http://www.nielsen.com/us/en/insights/reports/2014/shifts-in-viewing-the-cross-platform-report-q2-2014.html +53% +80% +60% -1% -1% -2% 18/34 35/49 50/64 Ages
  • 6. Engage users through streaming app q  In US more than 2 milion people watched last World Cup by a mobile App.1 q  270% increase in online video watched by smartphone and tablet.2 q  More than one bilion tap on Google Chromecast cast button.3 q  YouTube viewer habits prove “the bigger the screen, the longer people watch.”4 1)WatchESPN app access 2)Nielsen Q3 ‘14 Total Audience report 3) Google’s Omid Kordestani interview 2015 4) Youtube usage internal analysis.
  • 7. q  Playing a video content on your handheld device. q  Streaming taiolered for the user with q  Easiest way to enjoy video and music on user TV with Presentation Millestone
  • 8. Android multimedia framework Android support for playing several media types from media file stored inside the application (raw resources, standalone files) or for OTT streaming. *Camera, foto rendering and other media type are managed by it but they are out of scope for this talk. Network Protocols RTSP (RTP, SDP) HTTP/HTTPS progressive streaming HTTP/HTTPS live streaming Dynamic adaptive streaming over HTTP (DASH) Smooth Streaming Core Media Formats H.263 ->3GPP(.3gp),MPEG-4(.mp4) H.264 AVC -> 3GPP(.3gp),MPEG-4(.mp4),MPEG-TS(.ts) MPEG-4 SP -> 3GPP(.3gp) VP8 -> WebM(.webm),Matroska(.mkv) Note. Any given mobile device may provide support for additional formats or file types not listed in the table.
  • 9. Android multimedia framework documentation 50% Android multimedia framework questions are unaswered on Stackoverflow
  • 10. //1. Find the view from the layout VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview); //2. Setup video url myVideoView.setVideoURI(Uri.parse(SrcPath)); //3. Setup Video controller myVideoView.setMediaController(new MediaController(this)); //4. Start playing myVideoView.requestFocus(); myVideoView.start(); VideoView.java Media Playback 1/2
  • 11. //0. Get SurfaceView and its holder mPreview = (SurfaceView)findViewById(R.id.surfaceView); holder = mPreview.getHolder(); mp = new MediaPlayer(); //1. Create MediaPlayer object: //2. Add SurfaceHolder callback - Aware when SurfaceView is created holder.addCallback(new SurfaceHolder.Callback(){ .... @Override public void surfaceCreated(SurfaceHolder holder) { mp.setDisplay(holder); //3. Attach the surface to the player try { mp.setDataSource(filepath); //4. Prepare the Mediaplayer in sync or async mode ( prepareAsync() ) mp.prepare(); } catch (Exception e) {// Catch the exception} mp.start(); //5. Start the player }... }); MediaPlayer.java Media Playback 2/2
  • 12. ExoPlayer ExoPlayer is a media player built on top of the MediaExtractor and MediaCodec APIs released in Android 4.1 (API level 16). ExoPlayer provides default TrackRenderer implementations for audio and video, which make use of the MediaCodec and AudioTrack classes in the Android framework. During playback, your app can listen for events generated by the ExoPlayer that indicates the overall state of the player (ExoPlayer.Listener).
  • 13. player = ExoPlayer.Factory.newInstance(RENDERER_COUNT, minBuffer, maxBuffer); // 2. Construct renderers. DataSource dataSource = new UriDataSource(userAgent, bandwidthMeter); HlsChunkSource chunkSource = new HlsChunkSource(dataSource, url, manifest, bandwidthMeter, null, HlsChunkSource.ADAPTIVE_MODE_SPLICE); HlsSampleSource sampleSource = new HlsSampleSource(chunkSource, true, 3); MediaCodecVideoTrackRenderer videoRenderer = new MediaCodecVideoTrackRenderer(sampleSource, MediaCodec.VIDEO_SCALING_MODE_SCALE_TO_FIT, 5000, player.getMainHandler(), player, 50); MediaCodecAudioTrackRenderer audioRenderer = new MediaCodecAudioTrackRenderer(sampleSource); player.prepare(videoRenderer, audioRenderer); // 3. Inject the renderers through prepare. player.setSurface(surfaceView.getHolder().getSurface()); // 4. Pass the surface to the video renderer. player.setPlayWhenReady(true); // 5. Start playback … … player.release(); // Release when everything is done! ExoPlayer.java ExoPlayer – HLS implementation
  • 14. What next? q  Built-in players ü  AwesomePlayer (default player selected) ü  NuPlayer (Apple HLS) q  Extra player factories can be registered q  DIY mediaplayer ü  Demuxing: android.media.mediaExtractor ü  Decoding: android.media.MediaCodec ü  Video rendering: android.media.MediaCodec ü  Audio rendering: android.media.AudioTrack ü  Implement the interfaceframeworks/av/include/media/MediaPlayerInterface.h
  • 16. Android TV is Android!!!
  • 17. Smartphone 5” 320 dp TV Full HD 30” 320 dp 10 feet 16 inches 10 foot experience
  • 18. Keep calm and lean back!! Provides built-in tailored for 10 feet experience
  • 19. <uses-feature android:name="android.software.leanback" android:required="true" /> <application android:allowBackup="false” android:label="@string/app_name” android:theme="@style/Theme.Leanback" > <activity android:name="MainActivity” android:screenOrientation="landscape" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity> AndroidManifest.xml Android Manifest features1/2
  • 20. Android Manifest features 2/2 Supporting landscape orientation is mandatory No touch screen is required <uses-feature android:name="android.hardware.sensor.accelerometer” android:required="false" /> <uses-feature android:name="android.hardware.touchscreen” android:required="false"/> <activity android:name=”AndroidTvActivity” android:screenOrientation="landscape" > Limit your sensor! Your app doesn’t need to accelerate!!!
  • 21. Leanback UI component – BroswerFragment
  • 22. Leanback UI component – DetailFragment
  • 23. Building Live TV Apps TV Input Framework provides a unified method for receiving audio and video channel content from hardware sources and software sources. Android 5.0 (API level 21) or higher TV Provider manages all EPG info, meanwhile TV Input Manager handles streaming contents.
  • 24. TV Input Manager <service android:name=”droidcon.it.DroidconTvInputService" android:label="@string/sample_tv_input_label" android:permission="android.permission.BIND_TV_INPUT"> <intent-filter> <action android:name="android.media.tv.TvInputService" /> </intent-filter> <meta-data android:name="android.media.tv.input" android:resource="@xml/sample_tv_input" /> </service> onTune() event is fired when user selects a channel, and notifies the system TV app for changes in the content and meta data. TvInputService creates a TvInputService.Session that implements Handler.Callback to handle player state changes.
  • 25. TV provider <uses-permission android:name="com.android.providers.tv.permission.READ_EPG_DATA" /> <uses-permission android:name="com.android.providers.tv.permission.WRITE_EPG_DATA" /> Tv Channel COLUMN_DESCRIPTION COLUMN_DISPLAY_NAME COLUMN_DISPLAY_NUMBER COLUMN_INPUT_ID COLUMN_SERVICE_TYPE COLUMN_TRANSPORT_STREAM_ID COLUMN_TYPE COLUMN_INTERNAL_PROVIDER_DATA COLUMN_NETWORK_AFFILIATION COLUMN_ORIGINAL_NETWORK_ID COLUMN_SEARCHABLE COLUMN_SERVICE_ID COLUMN_VERSION_NUMBER COLUMN_VIDEO_FORMAT Tv Program COLUMN_LONG_DESCRIPTION COLUMN_POSTER_ART_URI COLUMN_SEASON_NUMBER COLUMN_SHORT_DESCRIPTION COLUMN_START_TIME_UTC_MILLIS COLUMN_THUMBNAIL_URI COLUMN_TITLE COLUMN_VERSION_NUMBER COLUMN_VIDEO_HEIGHT COLUMN_VIDEO_WIDTH COLUMN_AUDIO_LANGUAGE COLUMN_BROADCAST_GENRE COLUMN_CANONICAL_GENRE COLUMN_CHANNEL_ID COLUMN_CONTENT_RATING COLUMN_END_TIME_UTC_MILLIS COLUMN_EPISODE_NUMBER COLUMN_EPISODE_TITLE COLUMN_INTERNAL_PROVIDER_DATA A basic database of TV content metadata such as channel and program information. Manifest permission:
  • 26. Chromecast a cast-ready device for multi-screen experience source: www.google.it
  • 27. Chromecast some numbers •  10 million units sold •  1 billion times for Cast button •  300+ apps on Play Store •  6000 developers on 10000 apps
  • 28. Chromecast components •  Google Cast technology •  Multi-Screen experiece •  Google Cast SDK •  Sender Application •  Android app •  iOS app •  Chrome app •  Receiver Application •  Default Media Receiver •  Styled Media Receiver •  Custom Media Receiver
  • 29. Android Client Application library dependencies •  Minimum SDK version supported by Google Cast is 9 (Gingerbread) •  MediaRouter API of android-support-v7 •  Google Play Services •  AppCompat API of android-support-v7
  • 30. Android Client Application typical sender application flow •  Sender app starts MediaRouter device 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 and uses GoogleApiClient: GoogleApiClient.Builder •  Sender app launches the receiver app: Cast.CastApi.launchApplication •  Sender app creates a communication channel: Cast.CastApi.setMessageReceivedCallbacks •  Sender sends a message to the receiver over the communication channel: Cast.CastApi.sendMessage source: developers.google.com
  • 31. Cast-Ready Device Discovery capabilities Remote  Playback   Live  Audio   Live  Video   MediaRouteSelector.Builder builder = new MediaRouteSelector.Builder(); builder.addControlCategory(MediaControlIntent.CATEGORY_REMOTE_PLAYBACK); builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_AUDIO); builder.addControlCategory(MediaControlIntent.CATEGORY_LIVE_VIDEO); MediaRouterSelector selector = builder.build(); MainAc'vity.java  
  • 32. Media Cast Button easy approach for discovering source: developers.google.com source: developers.google.com public boolean onCreateOptionsMenu(Menu menu) { MenuItem mediaRouteMenuItem = menu.findItem(R.id.media_route_menu_item); MediaRouteActionProvider mediaRouteActionProvider = (MediaRouteActionProvider) MenuItemCompat.getActionProvider(mediaRouteMenuItem); mediaRouteActionProvider.setRouteSelector(mMediaRouteSelector); } MainAc'vity.java  
  • 33. RemoteMediaPlayer …finally MediaInfo mediaInfo = new MediaInfo.Builder("http://your.server.com/video.mp4") .setContentType("video/mp4") .setStreamType(MediaInfo.STREAM_TYPE_BUFFERED) .setMetadata(mediaMetadata) .build(); … mRemoteMediaPlayer = new RemoteMediaPlayer(); mRemoteMediaPlayer.load(mApiClient, mediaInfo, true); … MainAc'vity.java  
  • 34. Receiver Application powered by Chrome What is? HTML5 and Javascript application What does? Display the media content on TV Message handling Which type? Default  Media  Receiver   Styled  Media  Receiver   Custom  Media  Receiver   source: unknow
  • 35. Default Media Receiver simplest •  Off-the-shelf •  No UI customization •  No registration Source: developers.google.com
  • 36. Styled Media Receiver simple and customizable •  Similar to Default Media Player •  CSS UI customization •  Registration Source: developers.google.com
  • 37. Custom Media Receiver whatever you want •  Fully Web Applicaiton •  Debug(able) at 9222 •  Registration Source: developers.google.com
  • 38. Custom Media Receiver basic example <html> <head>   <title>Example minimum receiver</title> <script src="//www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js"></script> </head> <body> <video id='media'/> <script> window.mediaElement = document.getElementById('media'); window.mediaManager = new cast.receiver.MediaManager(window.mediaElement); window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance(); window.castReceiverManager.start(); </script> </body> </html> Index.htm  
  • 39. Custom Media Receiver advanced features •  Video Codification/Decodification •  H.264 High Profile Level 4.1, 4.2 and 5 •  VP8 •  Adaptive Bitrate Streaming •  HTTP Live Streaming (HLS) •  Dynamic Adaptive Streaming over HTTP (MPEG-DASH) •  Smooth Streaming •  Digital Rights Management •  Play Ready DRM •  Widevine DRM •  Media Player Library
  • 40. Custom Media Receiver advanced example Index.htm   <html> <head> <script src="//www.gstatic.com/cast/sdk/libs/mediaplayer/1.0.0/media_player.js" /> </head> <body> <script type="text/javascript"> window.defaultOnLoad = mediaManager.onLoad; mediaManager.onLoad = function (event) { if (window.player !== null) { player.unload(); window.player = null; }
  • 41. Custom Media Receiver advanced example if (event.data['media'] && event.data['media']['contentId']) { var url = event.data['media']['contentId']; window.host = new cast.player.api.Host({'mediaElement':mediaElement, 'url':url}); var ext = url.substring(url.lastIndexOf('.'), url.length); var startAt = event.data['media']['currentTime'] || 0; var autoplay = event.data['autoplay'] || true; var protocol = null; mediaElement.autoplay = autoplay; if (url.lastIndexOf('.m3u8') >= 0) { protocol = cast.player.api.CreateHlsStreamingProtocol(host); } else if (url.lastIndexOf('.mpd') >= 0) { protocol = cast.player.api.CreateDashStreamingProtocol(host); } else if (url.indexOf('.ism/') >= 0) { protocol = cast.player.api.CreateSmoothStreamingProtocol(host); } Index.htm  
  • 42. Custom Media Receiver advanced example host.onError = function(errorCode) { if (window.player) { window.player.unload(); window.player = null; } }; if (protocol !== null) { window.player = new cast.player.api.Player(host); window.player.load(protocol, startAt); } else { window.defaultOnLoad(event); } } } window.player = null; window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance(); castReceiverManager.start(); Index.html  
  • 43. Resources •  Google Cast: https://developers.google.com/cast •  Chromecast App: http://www.google.it/chrome/devices/chromecast/apps.html •  Google Cast Downloads: https://developers.google.com/cast/docs/downloads •  Github: https://github.com/googlecast •  Android TV: https://developer.android.com/tv •  Android TV Apps: http://www.google.it/chrome/devices/chromecast/apps.html •  Android TV codelab: g.co/dev/codelab-androidtv •  Github Leanback: https://github.com/googlesamples/androidtv-Leanback.git
  • 44. Enjoy the video thank you to all of you Source: www.huffingtonpost.ca +MatteoBonifazi +AlessandroMartellucci @mbonifazi @martellux