Example usage for android.media MediaRouter ROUTE_TYPE_LIVE_VIDEO

List of usage examples for android.media MediaRouter ROUTE_TYPE_LIVE_VIDEO

Introduction

In this page you can find the example usage for android.media MediaRouter ROUTE_TYPE_LIVE_VIDEO.

Prototype

int ROUTE_TYPE_LIVE_VIDEO

To view the source code for android.media MediaRouter ROUTE_TYPE_LIVE_VIDEO.

Click Source Link

Document

Route type flag for live video.

Usage

From source file:com.commonsware.android.preso.fragment.MainActivity.java

@Override
protected void onStart() {
    super.onStart();

    if (cb == null) {
        cb = new RouteCallback();
        router = (MediaRouter) getSystemService(MEDIA_ROUTER_SERVICE);
    }//from w  w w .  ja  v a  2  s  . c o m

    handleRoute(router.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO));
    router.addCallback(MediaRouter.ROUTE_TYPE_LIVE_VIDEO, cb);
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionLivestreamActivity.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
@Override/*ww  w . j a va2 s  .  co m*/
protected void onResume() {
    super.onResume();
    if (mSessionSummaryDeferredSetup != null) {
        mSessionSummaryDeferredSetup.run();
        mSessionSummaryDeferredSetup = null;
    }
    mHandler.postDelayed(mStreamRefreshRunnable, STREAM_REFRESH_TIME);
    if (UIUtils.hasJellyBeanMR1()) {
        mMediaRouter.addCallback(MediaRouter.ROUTE_TYPE_LIVE_VIDEO, mMediaRouterCallback);
    }
}

From source file:com.gdgdevfest.android.apps.devfestbcn.ui.SessionLivestreamActivity.java

/**
 * Updates the presentation display. If a suitable external display is attached. The video
 * will be displayed on that screen instead. If not, the video will be displayed normally.
 * @param forceDismiss If true, the external display will be dismissed even if it is still
 *                     available. This is useful for if the user wants to explicitly toggle
 *                     the external display off even if it's still connected. Setting this to
 *                     false will adjust the display based on if a suitable external display
 *                     is available or not.
 *//* w  ww .jav a2s.c  o m*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
private void updatePresentation(boolean forceDismiss) {
    if (!UIUtils.hasJellyBeanMR1()) {
        return;
    }

    // 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 || forceDismiss)) {
        hidePresentation();
    }

    // Show a new presentation if needed.
    if (mPresentation == null && presentationDisplay != null && !forceDismiss) {
        showPresentation(presentationDisplay);
    }

    // Show/hide toggle presentation action item
    if (mPresentationMenuItem != null) {
        mPresentationMenuItem.setVisible(presentationDisplay != null);
    }
}