Introduction
Wireless display technology is becoming more and more popular on Android* phones and tablets since Google started supporting Miracast on Android 4.2. Wireless display technology makes it easier for end users to expand their phone’s LCD size. I think there is a good chance that ISVs will integrate the wireless display feature into their applications, especially games and video players.
But how to realize Intel® wireless display differentiation for Miracast on Android for x86 phones is a big challenge for enabling ISVs. This article introduces how to enable dual display differentiation for Miracast by showing a case study of enabling iQiyi online video player and WPS office on K900. We hope that lots of amazing applications can be enabled in the future.
What is Miracast
The Wi-Fi Alliance officially announced Wi-Fi* CERTIFIED Miracast on 2012.9.19 , which is a groundbreaking solution for seamlessly displaying video between devices, without cables or a network connection. Users can do things like view pictures or videos from a smartphone on a big screen television, share a laptop screen with the conference room projector in real time, and watch live programs from a home cable box on a tablet. Miracast connections are formed using Wi-Fi CERTIFIED Wi-Fi Direct*, so access to a Wi-Fi network is not needed—the ability to connect is inside Miracast certified devices.
The connection of Miracast is based on a Wi-Fi direct, peer to peer connection. The Wi-Fi-based Miracast architecture is shown below.
Figure 1: Miracast* architecture
There are four modes of Miracast connection as shown below:
Figure 2: Miracast* connection modes
With a Miracast connection, you can enable connectivity across devices without Wi-Fi AP infrastructure, as topology 1 shows. You can also connect to a display via an adaptor while connecting to an AP, as topology 2 shows. It is very convenient to watch online video at home with this mode. If you have a smart TV that also supports Miracast, your TV, AP, and your smartphone can even connect to each other, as topology 4 shows.
According to the Miracast standard, the interactive mode of source and display devices can be diagrammed as follows:
Figure 3: Miracast* session management
Source and display devices discover each other’s Miracast capabilities prior to connection setup. The connection is based on Wi-Fi direct or TDLS. Source and display devices determine the parameters for the Miracast session based on capability negotiation. The negotiation process is based on the TCP connection. Source devices will transfer content to display devices via MPEG2-TS format based on the UDP connection.
Miracast wireless streaming-supported formats are listed in Table 4.
Table 4: Miracast* streaming format
Miracast on Android 4.2
Google started supporting Miracast on Android version 4.2. End users can share movies, photos, YouTube videos, and anything that’s on your screen with HDTV via wireless display technology. The external HDTV is listed as an external display.
Now Miracast on Android supports clone mode and presentation mode, as shown below:
Figure 5: Miracast* support modes
Clone mode duplicates the phone display on the remote display. The resolution of the frames sent to the adapter matches the resolution of the local display. In this mode, both local and remote displays are turned on and show the same content.
In presentation mode, Android now allows your app to display unique content on additional screens that are connected to the user’s device over either a wired connection or Wi-Fi. The apps must be modified to support this mode, or they will default to clone mode.
Develop differentiation for Miracast on Intel Architecture (IA) phone
Intel’s wireless display solution on Android phones and tablets is fully compatible with Miracast. We also enable some apps with differentiation usages to Miracast on IA phone.
The first one is to enable iQiyi to realize the video background streaming function. Users can send video to a remote display at 1080p resolution using a iQiyi app that enables background streaming while users can navigate out of the app and play 1080p video on the local screen or use any other application, including sending email or accessing their browser without any disruption to background playback, as shown below:
Figure 6: iQiyi video BGM function
The second one is to enable WPS office to realize split the UI function on both local and remote displays. When connecting to TV via wireless display, the enabled WPS office app can show PPT slides on the remote screen while showing PPT notes on the phone’s screen, which is very convenient for the speaker. We plan to add a timer clock on the phone’s screen to give a time reminder to the speaker in the future.
Figure 7: WPS office split UI function
These two differentiation usages are developed based on Miracast’s Presentation mode using the phone’s IA hardware capability. The two applications have been uploaded to Intel AppUp® for end users to download and install on their IA phones.
Case study: How to enable dual display differentiation usages
In this section, I will introduce how to realize a video background streaming function based on our experience of enabling a iQiyi app.
As we know, to realize the video BGM function, the key difficulty is to get a service to play video in the background and deal with the surface view or video view correctly. When users press the home key, the surface view or video view will be destroyed automatically, so we have to apply a secondary display to show the background streaming video. The program flowchart is shown below:
Figure 8: Background video streaming flow chart
To create unique content for a secondary display, extend the Presentation
class and implement the onCreate()
callback. Within onCreate()
, specify your UI for the secondary display by calling setContentView()
. As an extension of the Dialog
class, the Presentation
class provides the region in which your app can display a unique UI on the secondary display.
There are two methods for applying the secondary display for your presentation. Use either the DisplayManager
or MediaRouter
APIs. The easiest way to choose a presentation display is to use the MediaRouter
API. The media router service keeps track of which audio and video routes are available on the system. The media router recommends the preferred presentation display that the application should use if it wants to show content on the secondary display.
Here's how to use the media router to create and show a presentation on the preferred presentation display using getPresentationDisplay()
.
MediaRouter mediaRouter = (MediaRouter) context.getSystemService(Context.MEDIA_ROUTER_SERVICE); MediaRouter.RouteInfo route = mediaRouter.getSelectedRoute(); if (route != null) { Display presentationDisplay = route.getPresentationDisplay(); if (presentationDisplay != null) { Presentation presentation = new MyPresentation(context, presentationDisplay); presentation.show(); } }
Another way to choose a presentation display is to use the DisplayManager
API directly. The display manager service provides functions to enumerate and describe all displays that are attached to the system including displays that may be used for presentations.
The display manager keeps track of all displays in the system. Here's how to identify suitable displays for showing presentations using getDisplays(String)
and the DISPLAY_CATEGORY_PRESENTATION
category.
DisplayManager displayManager = (DisplayManager) context.getSystemService(Context.DISPLAY_SERVICE); Display[] presentationDisplays = displayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION); if (presentationDisplays.length > 0) { Display display = presentationDisplays[0]; Presentation presentation = new MyPresentation(context, presentationDisplay); presentation.show(); }
Developers can Reference the presentation demo code in Android SDK shown as below:
\sdk\sources\android-17\android\app\Presentation.java
Summary
Besides the selling point of Intel Inside® for IA-based phones and tablets, the wireless display feature may become a shining point. ISVs should take notice and develop more innovative usages based on wireless display, especially the dual display differentiation usages.
Reference
- http://www.wi-fi.org
- http://developer.android.com/about/versions/android-4.2.html
- Wi-Fi_Display_Technical_Specification_v1.0.0
Copyright © 2013 Intel Corporation. All rights reserved.
*Other names and brands may be claimed as the property of others.