Code example for MediaRouter

Methods: getSelectedRoute

0
    	mSurfaceRoot.setLayoutParams(lp);
    } 
     
    private void updatePresentation() { 
        // Get the current route and its presentation display. 
        MediaRouter.RouteInfo route = mMediaRouter.getSelectedRoute(
                MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
        Display presentationDisplay = route != null ? route.getPresentationDisplay() : null;
 
        // Dismiss the current presentation if the display has changed. 
        if (mPresentation != null && mPresentation.getDisplay() != presentationDisplay) {
            mPresentation.dismiss();
            mPresentation = null;
        } 
 
        // Show a new presentation if needed. 
        if (mPresentation == null && presentationDisplay != null) {
            mPresentation = new VideoPresentation(this, presentationDisplay);
            mPresentation.setOnDismissListener(mOnDismissListener);
            try { 
                mPresentation.show();