Scaricare la presentazione
La presentazione è in caricamento. Aspetta per favore
PubblicatoCleto Franceschini Modificato 10 anni fa
1
Video Streaming dal player standard Android verso device non convenzionali GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
2
Chi siamo? a.martellucci[at]reply.it @martellux +AlessandroMartellu cci m.bonifazi[at]reply.it @mbonifazi +MatteoBonifazi http://www.reply.e u http://www.gaiareply.c om
3
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Reply spa è una delle società leader nel settore IT Opera in Italia, Germania, UK, Benelux, USA and Brasile. Open Reply è una società del Gruppo Reply spa specializzata su tecnologie open source, soluzioni web multicanale and applicazioni mobile. Based in Rome, Open Reply’s Android Lab is a young team of over 20 engineers 100% focused on Android development. Specializzati in applicazioni broadcasting, bancarie e customizzazioni del sistema operativo Android. Open Reply & Android Lab
4
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Ex1 – Streaming di un contenuto su smartphone e tablet Ex2 – Streaming con app per Ex3 – Divertirsi utilizzando il Codelab Millestones
5
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Android multimedia framework Android supporta diversi tipi di formati per lo streaming di contenuti I file possono essere salvati all’interno dell’applicazione (raw resources, standalone files) oppure utilizzando servizi di OTT streaming. La documentazione dell’Android multimedia framework copre soltanto i casi base.
6
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Tipi supportati HttpLiveStreaming Protocol 3 è supportato da Android 4.0. La migliore implementazione si trova su dispositivi KitKat. source: http://developer.android.com/guide/appendix/media- formats.html http://developer.android.com/guide/appendix/media- formats.html
7
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci //1. Recuperare la view VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview); //2. Setup video url myVideoView.setVideoURI(Uri.parse(SrcPath)); //3. Impostare il video controller myVideoView.setMediaController(new MediaController(this)); //4. Inizio dello streaming. myVideoView.requestFocus(); myVideoView.start(); android.widget.VideoView MediaPlayer code example
8
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Android TV L’intrattenimento per la nostra sala Source:http://www.televisedrevolution.com/
9
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Nexus Player Source:http://www.televisedrevolution.com/ 1.8GHz Quad Core, Intel® Atom™ Imagination PowerVR Series 6 Graphics 2D/3D Engine 1GB RAM 8GB storage Asus device – 235 g
10
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Android TV app caratteristiche tecniche Android TV device hanno Android Lollipop 5.0. Android TV possiede la stessa versione del Multimedia Framework dei normali dispisitvi Android. Android TV app sono compatibili dalle API 17. Basate sulla libreria Leanback Android Support.
11
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci 10 feet experience Smartphone 5” 320 dp TV Full HD 30” 320 dpi 3 metri 50 centimetri
12
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Manifest features Supportare landscape Portrait activity sono escluse
13
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Manifest features No touch screen
14
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Manifest features Limit sensor
15
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Keep calm and lean back!! Fornisce componeti built-in customizzati per lo schermo della TV
16
Leanback support library <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" > GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
17
Leanback support library Model View Presenter Presenter Model View GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
18
Leanback UI component BroswerFragment Permette agli sviluppatore di avere un layout della propria applicazione già precostruito e pronto all’uso.
19
Leanback UI component DetailFragment Mostra informazioni riguardo i contenuti selezionati dall’utente. GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
20
Chromecast un cast-ready device per la multi-screen experience source: www.google.it GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
21
Chromecast caratteristiche hardware source: www.pcworld.com GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
22
Chromecast componenti Google Cast Esperienza Multi-Screen Google Cast SDK Applicazione client Android app iOS app Chrome app Applicazione receiver Default Media Receiver Styled Media Receiver Custom Media Receiver GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
23
Applicazione client Android librerie e dipendenze Versione minima supportata è la 9 (Gingerbread) MediaRouter API nel android-support-v7 Google Play Services AppCompat API nel android-support-v7 GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci
24
Applicazione client Android tipico flusso di esecuzione Client usa MediaRouter per fare il discovery: MediaRouter.addCallback MediaRouter informa il client della route selezionata: MediaRouter.Callback.onRouteSelected Il client recupera l’istanza di CastDevice: CastDevice.getFromBundle Il client usa GoogleApiClient per collegarsi allo strato di sistema: GoogleApiClient.Builder Il client avvia l’applicazione receiver: Cast.CastApi.launchApplication Il client instaura il canale di comunicazione: Cast.CastApi.setMessageReceivedCallbacks Il client invia messaggi di protocollo sul canale di trasmissione: Cast.CastApi.sendMessage source: developers.google.com
25
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Ricerca Cast-Ready Device caratteristiche Remote Playback Live AudioLive Video MediaRouteSelector.Builder mediaRouteSelectorBuilder = new MediaRouteSelector.Builder(); mediaRouteSelectorBuilder.addControlCategory(MediaControlIntent.CATEGORY_REM OTE_PLAYBACK); mediaRouteSelectorBuilder.addControlCategory(MediaControlIntent.CATEGORY_LIVE _AUDIO); mediaRouteSelectorBuilder.addControlCategory(MediaControlIntent.CATEGORY_LIVE _VIDEO); MediaRouterSelector mediaRouterSelector = mediaRouterSelectorBuilder.build();
26
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Media Cast Button facile approccio alla ricerca 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); …. }
27
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Applicazione Receiver quale mistero? Che cosa è? Applicazione HTML5 - Javascript Che cosa fa? Visualizza il contenuto a video Gestisce i messaggi Quali tipo esistono? Default Media Receiver Styled Media ReceiverCustom Media Receiver
28
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Default Media Receiver il più semplice Off-the-shelf Nessuna personalizzazione Nessuna registrazione Source: developers.google.com
29
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Styled Media Receiver semplice e personalizzabile Simile al Default Media Player CSS per la personalizzazione Registrazione Source: developers.google.com
30
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Custom Media Receiver (1/3) qualsiasi cosa Web Applicaiton Debug(able) at 9222 Registrazione Source: developers.google.com
31
GDG Fest Roma – 2014 – Matteo Bonifazi & Alessandro Martellucci Custom Media Receiver (2/3) esempio Example minimum receiver window.mediaElement = document.getElementById('media'); window.mediaManager = new cast.receiver.MediaManager(window.mediaElement); window.castReceiverManager = cast.receiver.CastReceiverManager.getInstance(); window.castReceiverManager.start();
32
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Custom Media Receiver (3/3) caratteristiche avanzate 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
33
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Channel, Namespace e Protocol (1/2) comunicazione Protocol: insieme di messaggi Namespace: nome protocollo Channel: lo strato di comunicazione class CustomChannel implements Cast.MessageReceivedCallback { public String getNamespace() { return “urn:x-cast:com.channel.custom”; } @Override public void onMessageReceiver(CastDevice castDevice, String namespace, String message) { … } } … Cast.CastApi.setMessageReceivedCallbacks(mApiClient, mCustomChannel.getNamespace(), mCustomChannel); …
34
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Channel, Namespace e Protocol (2/2) comunicazione Media Namespace: urn:x-cast:com.google.media.cast RemoteMediaPlayer MediaManager RECEIVER MEDIA CHANNEL … window.mediaManager = new cast.receiver.MediaManager(window.mediaElement); … CLIENT MEDIA CHANNEL … Cast.CastApi.setMessageReceivedCallbacks(mApiClient, mRemoteMediaPlayer.getNamespace(), mCustomChannel); …
35
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Google Api Client e Media Route Provider manufacturer Source: developers.google.com CastDevice selectedCastDevice = CastDevice.getFromBundle(selectedRouteInfo.getExtras); Cast.CastOptions.Builder apiOptionsBuilder = new Cast.CastOptions.Builder(selectedCastDevice, …); googleApiClient = new GoogleApiClient.Builder().addApi(Cast.API, apiOptionsBuilder.build()).build(); googleApiClient.connect(); Cast.CastApi.launchApplication(googleApiClient, applicationId, launchOptions); Cast.CastApi.joinApplication(googleApiClient); Cast.CastApi.stopApplication(googleApiClient); Cast.CastApi.leaveApplication(googleApiClient);
36
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci RemoteMediaPlayer …finalmente 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); …
37
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Buona visione Source: www.huffingtonpost.ca Grazie a tutti
38
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Risorse Google Cast -> https://developers.google.com/cast https://developers.google.com/cast Chromecast App -> http://www.google.it/chrome/devices/chromecast/apps.html http://www.google.it/chrome/devices/chromecast/apps.html Google Cast Downloads -> https://developers.google.com/cast/docs/downloads https://developers.google.com/cast/docs/downloads Github -> https://github.com/googlecast https://github.com/googlecast Android TV -> https://developer.android.com/tv https://developer.android.com/tv Nvidia Guideline -> https://developer.nvidia.com/android-tv-developer-guide https://developer.nvidia.com/android-tv-developer-guide Github -> https://github.com/googlesamples/androidtv-Leanback.git https://github.com/googlesamples/androidtv-Leanback.git Android Mediaplayer-> http://developer.android.com/guide/topics/media/mediaplayer.html http://developer.android.com/guide/topics/media/mediaplayer.html ExoPlayer -> https://github.com/google/ExoPlayerhttps://github.com/google/ExoPlayer
39
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Libro Sviluppare applicazioni Android in sette giorni https://androidinsettegiorni.wordpress.com/
40
GDG Fest Roma– 2014 – Matteo Bonifazi & Alessandro Martellucci Contatti a.martellucci[at]reply.it @martellux +AlessandroMartellu cci m.bonifazi[at]reply.it @mbonifazi +MatteoBonifazi http://www.reply.e u http://www.gaiareply.c om
Presentazioni simili
© 2024 SlidePlayer.it Inc.
All rights reserved.