Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I share screen to another device base on WiFi direct connection

I want to develop an AP to share (SOURCE) screen to another (SINK) device by using WiFi direct connection.

I successfully connect two devices via Wifi direct API but getPresentationDisplay() returns null. It seems SOURCE device does not find any additional display service exported by SINK device. Does API level 4.2.2 support it? Or is any API that I can register the display service to SOURCE?

//Get Media router service
mMediaRouter = (MediaRouter) getSystemService(Context.MEDIA_ROUTER_SERVICE);
MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
if (route != null) {
    Display presentationDisplay = route.getPresentationDisplay();
    if (presentationDisplay != null) {
        Presentation presentation = new DemoPresentation(this, presentationDisplay);
        Log.i("tracer", "presentation.show();");
        presentation.show();
    }
}
like image 538
user2512862 Avatar asked Jun 23 '13 04:06

user2512862


People also ask

Can I screen mirror with WiFi Direct?

On your Android phone, Navigate to Settings. Select the bottom right hand menu and tap Wi-Fi Direct. Your TV should appear in the list. Tap on the Smart TV listed and press Accept to connect to it.

How do I Share with WiFi Direct?

Send files with Wi-Fi Direct: Open Files, touch and hold a file you want to send, and go to More > Share > Wi-Fi Direct. When another device is detected, touch its name to establish the connection and begin file transfer.


1 Answers

I'm author if CatVision.io - an screen share software component for Android applications. The source code relevant to a media projection (basically a screen of the device) is here: https://github.com/TeskaLabs/CatVision-io-SDK-Android/blob/master/cvio/src/main/java/com/teskalabs/cvio/CatVision.java

like image 102
Ales Teska Avatar answered Oct 21 '22 15:10

Ales Teska