droidcon2013 miracast final2
DESCRIPTION
TRANSCRIPT
A new application paradigm: Using the 2nd
screen API with Miracast
• Who we are: short recap of LG's Android highlights
• What is Miracast and how can I use it?
• Android API Level 17: The 2nd Screen API hands-on
• Usage Scenarios – what can I do with it?
LIFE’S GOOD
WHEN YOU MAKE
THE MOST OF IT!
Nexus 4 is the new smartphone from Google. Developed by LG. With cutting edge hardware, your favorite Google Apps, and the latest version of Android, Nexus 4 puts the best of Google in the palm of your hand.
NEXUS 4
LG TECHNOLOGY LEADERSHIP
True HD IPSPlus display and cutting-edge Zerogap Touch
Thinner camera & advanced touch screen
Superior mobile experience
in speed, performance, battery usage and graphics Innovation in energy
density & efficiency
Wi-Fi Miracast
What is Miracast?
• Wireless Replacement for HDMI
• Based on existing standards
• Using existing device capabilities
• Open for the industry
• Compliance-tested by Wi-Fi Alliance
Miracast Concept
SINK SOURCE
Link content encryption (Optional)
AV mux
Transport
LLC
Wi-Fi MAC (direct link)
Wi-Fi PHY
Video encode
Packetize
Audio encode
Packetize
Link content decrypt (Optional)
AV Demux
Transport
LLC
Wi-Fi MAC (direct link)
Wi-Fi PHY
Video decode
Depacketize
Audio decode
Depacketize
Display frames Audio samples Render Render Synchronized
Miracast Logical Block diagram
Game content
UI content
Video content
Composition Composited
display surface
Display
controller
Display
capture
Encode Encoded video
bit-stream
PCM audio MPEG-2
packeting
MPEG-2 TS
Audio/Video
mux
RTP
Transport
LCD
Wi-Fi
Sounds Great! Can I Use It Now?
Miracast Source (e.g. Nexus4, LG Optimus G)
Miracast Display (e.g. LG BlueRay Player, HomeCinema, SmartTV, Monitor)
Yes! It is commercially available!
Android 4.2
Secondary Displays
What's the secondary display API?
From 4.2 (API Level 17), Android supports output to multiple displays in a hardware-agnostic way, which means: You can implement support for multiple displays in your applications without having to worry about the way those displays are connected! You can control the output on this displays independently of the phones screen!
Presentation Class
associated with android.view.Display
Before showing a Presentation it's important to choose the Display on which it will appear. There are two main ways to choose a Display: 1. Using the MediaRouter – System will decide 2. Using the DisplayManager – Enumeration of Displays
Code Example - How to get a display
protected Display getDisplay() {
if(mUseMediaRouter){
//Use the MediaRouter that supports live video
MediaRouter.RouteInfo route =
mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
mCurrentDisplay = route.getPresentationDisplay();
}
else {
// Get all available displays using the DisplayManager
Display[] displays =
mDisplayManager.getDisplays(
DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
// Keep an object to the first available external display
mCurrentDisplay = displays[0];
}
return mCurrentDisplay;
}
Getting the displays metrics
You can obtain the metrics with getMetrics() of the external Display in order to use the proper resources for the external display
Keep in mind that screens connected to the users device often have a larger screen size and likely a different screen density. Because the screen characteristics may differ, you should provide resources that are optimized specifically for such larger displays.
Simple Example: Presentation
Hello droidcon!
public class TextDemoPresentation extends Presentation {
private TextView mText;
public TextDemoPresentation(Context context, Display
display) {
super(context, display);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Inflate the layout.
setContentView(
R.layout.presentation_text);
// Find the TextView field
mText = (TextView)
findViewById(R.id.demoText);
}
}
Lifecycle
A presentation is canceled when the display to which it is attached is removed. An activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed. If you use OpenGL in the Presentation the OpenGL context will get lost on pausing. The only way to keep the context during pause/resume is to call onPause() and onResume() manually on the GLSurfaceView in the pause and resume callbacks of your activity. public void onPause() {
mGLSurfaceView.onPause();
}
public void onResume() {
mGLSurfaceView.onResume();
}
Developer Options
Android provides an easy on-device method to test your app using the secondary display API in the developer option. You can select several resolutions and once activated you get an overlay emulating the secondary screen(s)
Secondary Displays A new application paradigm
Use cases - Ideas
Add external Display support to your existing app in order to utilize other (bigger) displays when available, e.g. a browser could render content with the external displays resolution
Use cases - Ideas
Add a special mode to your existing application to show the content on the external display when available and provide special input mode on the phone, e.g. just browser input fields and moving controls
Use cases - Ideas
Dedicated apps which work ONLY with external displays, e.g. a Home Office App to utilize your phone as PC replacement together with mouse and keyboard
Summary
Miracast is • a method to transmit audio/video from a mobile
device to external display(s) • OPEN, STANDARDIZED and COMMERCIALLY
AVAILABLE Secondary Display API is • introduced with Android API Level 17 • adds methods to control the content on multiple
displays
Exciting new use cases for applications!!!
http://developer.lge.com
www.lgworld.com
Thank you.
Don’t miss the
demo at our
booth!