当前位置: 首页>>代码示例>>Java>>正文


Java MediaRouter.RouteInfo方法代码示例

本文整理汇总了Java中android.support.v7.media.MediaRouter.RouteInfo方法的典型用法代码示例。如果您正苦于以下问题:Java MediaRouter.RouteInfo方法的具体用法?Java MediaRouter.RouteInfo怎么用?Java MediaRouter.RouteInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.support.v7.media.MediaRouter的用法示例。


在下文中一共展示了MediaRouter.RouteInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onRouteSelected

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo route) {
    Log.d(TAG, "onRouteSelected: route=" + route);

    if (route.supportsControlCategory(
            MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)){
        // Stop local playback (if necessary)
        // ...

        // Save the new route
        mRoute = route;

        // Attach a new playback client
        mRemotePlaybackClient = new RemotePlaybackClient(getBaseContext(), mRoute);


        // Start remote playback (if necessary)
        // ...
    }
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:21,代码来源:VideoPlayerActivity.java

示例2: onRouteUnselected

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo route, int reason) {
    Log.d(TAG, "onRouteUnselected: route=" + route);

    if (route.supportsControlCategory(
            MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)){

        // Changed route: tear down previous client
        if (mRoute != null && mRemotePlaybackClient != null) {
            mRemotePlaybackClient.release();
            mRemotePlaybackClient = null;
        }

        // Save the new route
        mRoute = route;

        if (reason != MediaRouter.UNSELECT_REASON_ROUTE_CHANGED) {
            // Resume local playback  (if necessary)
            // ...
        }
    }
}
 
开发者ID:tgbMedia,项目名称:Android-app,代码行数:23,代码来源:VideoPlayerActivity.java

示例3: onCastDeviceDetected

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onCastDeviceDetected(final MediaRouter.RouteInfo info) {
    // FTU stands for First Time Use:
    if (!PrefUtils.isFtuShown(ActionBarCastActivity.this)) {
        // If user is seeing the cast button for the first time, we will
        // show an overlay that explains what that button means.
        PrefUtils.setFtuShown(ActionBarCastActivity.this, true);

        LogHelper.d(TAG, "Route is visible: ", info);
        new Handler().postDelayed(new Runnable() {

            @Override
            public void run() {
                if (mMediaRouteMenuItem.isVisible()) {
                    LogHelper.d(TAG, "Cast Icon is visible: ", info.getName());
                    showFtu();
                }
            }
        }, DELAY_MILLIS);
    }
}
 
开发者ID:mrinalgit-dev,项目名称:MrinalMusicPlayer,代码行数:22,代码来源:ActionBarCastActivity.java

示例4: showDialog

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public boolean showDialog() {
    try {
        Activity currentActivity = getActivity();
        final FragmentManager fm = ((FragmentActivity) currentActivity).getSupportFragmentManager();
        if (!isAttachedToWindow()
                || (fm.findFragmentByTag(CONTROLLER_TAG) != null)
                || (fm.findFragmentByTag(CHOOSER_TAG) != null) ) {
            return false;
        }

        MediaRouter.RouteInfo route = getMediaRouter().getSelectedRoute();
        if (route.isDefault() || !route.matchesSelector(mSelector)) { // route chooser
            Intent intent = ((MediaProjectionManager)
                    currentActivity.getSystemService(Context.MEDIA_PROJECTION_SERVICE)).createScreenCaptureIntent();
            currentActivity.startActivityForResult(intent, CastScreenActivity.SCREEN_CAPTURE_REQUEST);

            return true;
        } else { // route controller
            return super.showDialog();
        }
    } catch (NoSuchFieldException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
        Log.e(TAG, "MediaRouteButton implementation changed - " + CastScreenActivity.PLEASE_REPORT_BUG);
    }
    return false;
}
 
开发者ID:ankyl,项目名称:castscreen,代码行数:27,代码来源:CastScreenMediaRouteButton.java

示例5: selectDevice

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
/**
 * Tries to select a device with the given device ID. The device ID is cached so that if the
 * route does not exist yet, we will connect to it as soon as it comes back up again
 *
 * @param deviceId the ID of the device to connect to
 */
private void selectDevice(String deviceId) {
    if (deviceId == null) {
        release();
        return;
    }

    setDeviceId(deviceId);

    if (mDebug) Log.d(TAG, "Trying to select " + getDeviceId());

    // See if we can select the device at this point.
    if (getMediaRouter() != null) {
        for (MediaRouter.RouteInfo route : getMediaRouter().getRoutes()) {
            if (deviceId.equals(route.getId())) {
                route.select();
                break;
            }
        }
    }
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:27,代码来源:DefaultMediaRouteController.java

示例6: fromRoute

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
/**
 * @param route The route information provided by Android.
 * @return A new MediaSink instance corresponding to the specified {@link RouteInfo}.
 */
public static MediaSink fromRoute(MediaRouter.RouteInfo route) {
    return new MediaSink(
        route.getId(),
        route.getName(),
        CastDevice.getFromBundle(route.getExtras()));
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:11,代码来源:MediaSink.java

示例7: fromSinkId

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
/**
 * @param sinkId The id of the sink to find among known media routes.
 * @param router The instance of {@link MediaRouter} to enumerate the routes with.
 * @return A {@link MediaSink} corresponding to the {@link RouteInfo} with the specified id if
 * found, null otherwise.
 */
@Nullable
public static MediaSink fromSinkId(String sinkId, MediaRouter router) {
    for (MediaRouter.RouteInfo route : router.getRoutes()) {
        MediaSink sink = MediaSink.fromRoute(route);
        if (sink.getId().equals(sinkId)) return sink;
    }
    return null;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:MediaSink.java

示例8: onRouteAdded

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteAdded(MediaRouter router, MediaRouter.RouteInfo route) {
    if (route == null || !route.matchesSelector(mRouteSelector)) return;

    MediaSink sink = MediaSink.fromRoute(route);
    if (mSinks.contains(sink)) return;
    mSinks.add(sink);
    updateChromeMediaRouter();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:10,代码来源:DiscoveryCallback.java

示例9: onRouteRemoved

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteRemoved(MediaRouter router, MediaRouter.RouteInfo route) {
    MediaSink sink = MediaSink.fromRoute(route);
    if (!mSinks.contains(sink)) return;
    mSinks.remove(sink);
    updateChromeMediaRouter();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:8,代码来源:DiscoveryCallback.java

示例10: onRouteChanged

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteChanged(MediaRouter router, MediaRouter.RouteInfo route) {
    // Sometimes onRouteAdded is not called for the route as it doesn't yet match the selector.
    // onRouteChanged() will be called later when the matching category is added.
    if (route == null) return;

    if (route.matchesSelector(mRouteSelector)) {
        onRouteAdded(router, route);
    } else {
        onRouteRemoved(router, route);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:DiscoveryCallback.java

示例11: setSelectedRoute

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
public void setSelectedRoute(MediaRouter.RouteInfo device){
    mSelectedRoute = device;
    if(CastDebug.DBG){
        CastDebug.log("setSelectedRoute: device is null ?"+(device==null));
    }
    if(device==null)
        onDisconnect();
}
 
开发者ID:archos-sa,项目名称:aos-Video,代码行数:9,代码来源:ArchosVideoCastManager.java

示例12: createApiClient

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
private GoogleApiClient createApiClient(
        MediaRouter.RouteInfo route, Cast.Listener listener, Context context) {
    CastDevice selectedDevice = CastDevice.getFromBundle(route.getExtras());

    Cast.CastOptions.Builder apiOptionsBuilder = Cast.CastOptions
            .builder(selectedDevice, listener)
            // TODO(avayvod): hide this behind the flag or remove
            .setVerboseLoggingEnabled(true);

    return new GoogleApiClient.Builder(context)
            .addApi(Cast.API, apiOptionsBuilder.build())
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
}
 
开发者ID:Smalinuxer,项目名称:Vafrinn,代码行数:16,代码来源:CreateRouteRequest.java

示例13: onRouteUnselected

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteUnselected(MediaRouter router, MediaRouter.RouteInfo info) {
  if (isRemoteDisplaying()) {
    CastRemoteDisplayLocalService.stopService();
  }
  castDevice = null;
}
 
开发者ID:ferranpons,项目名称:android-cast-remote-display-sample,代码行数:8,代码来源:MainActivity.java

示例14: onRouteSelected

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteSelected(MediaRouter router, MediaRouter.RouteInfo info) {
    Log.d(TAG, "onRouteSelected");
    // Handle the user route selection.
    mSelectedDevice = CastDevice.getFromBundle(info.getExtras());

    launchReceiver();
}
 
开发者ID:stantronic,项目名称:PinCast-Sender-Android,代码行数:9,代码来源:PinCastActivity.java

示例15: onRouteAdded

import android.support.v7.media.MediaRouter; //导入方法依赖的package包/类
@Override
public void onRouteAdded(final MediaRouter router, final MediaRouter.RouteInfo route) {
    Log.d(TAG, "Route added: " + route.getName());
    if (mRouteId != null && mRouteInfo == null && mRouteId.equals(route.getId())) {
        restoreRoute();
    }
}
 
开发者ID:felixb,项目名称:basscast,代码行数:8,代码来源:BrowseActivity.java


注:本文中的android.support.v7.media.MediaRouter.RouteInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。