Tabnine Logo
MediaRouter$RouteInfo
Code IndexAdd Tabnine to your IDE (free)

How to use
MediaRouter$RouteInfo
in
android.support.v7.media

Best Java code snippets using android.support.v7.media.MediaRouter$RouteInfo (Showing top 20 results out of 315)

origin: square/assertj-android

public MediaRouterRouteInfoAssert hasName(String name) {
 isNotNull();
 String actualName = actual.getName();
 assertThat(actualName) //
   .overridingErrorMessage("Expected name <%s> but was <%s>.", name, actualName) //
   .isEqualTo(name);
 return this;
}
origin: square/assertj-android

public MediaRouterRouteInfoAssert hasDescription(String description) {
 isNotNull();
 String actualDescription = actual.getDescription();
 assertThat(actualDescription) //
   .overridingErrorMessage("Expected description <%s> but was <%s>.", description,
     actualDescription) //
   .isEqualTo(description);
 return this;
}
origin: square/assertj-android

public MediaRouterRouteInfoAssert hasId(String id) {
 isNotNull();
 String actualId = actual.getId();
 assertThat(actualId) //
   .overridingErrorMessage("Expected id <%s> but was <%s>.", id, actualId) //
   .isEqualTo(id);
 return this;
}
origin: googlesamples/android-MediaRouter

@Override
public void updateStatistics() {
  // clear stats info first
  mStatsInfo = "";
  Intent intent = new Intent(SampleMediaRouteProvider.ACTION_GET_STATISTICS);
  intent.addCategory(SampleMediaRouteProvider.CATEGORY_SAMPLE_ROUTE);
  if (mRoute != null && mRoute.supportsControlRequest(intent)) {
    ControlRequestCallback callback = new ControlRequestCallback() {
      @Override
      public void onResult(Bundle data) {
        if (DEBUG) {
          Log.d(TAG, "getStatistics: succeeded: data=" + data);
        }
        if (data != null) {
          int playbackCount = data.getInt(
              SampleMediaRouteProvider.DATA_PLAYBACK_COUNT, -1);
          mStatsInfo = "Total playback count: " + playbackCount;
        }
      }
      @Override
      public void onError(String error, Bundle data) {
        Log.d(TAG, "getStatistics: failed: error=" + error + ", data=" + data);
      }
    };
    mRoute.sendControlRequest(intent, callback);
  }
}
origin: derry/delion

private void sendControlIntent(final Intent intent, final ResultBundleHandler bundleHandler) {
  Log.d(TAG, "Sending intent to %s %s", getCurrentRoute().getName(),
      getCurrentRoute().getId());
  logIntent("sendControlIntent ", intent);
  if (getCurrentRoute().isDefault()) {
    Log.d(TAG, "Route is default, not sending");
    return;
  }
  getCurrentRoute().sendControlRequest(intent, new MediaRouter.ControlRequestCallback() {
    @Override
    public void onResult(Bundle data) {
      if (data != null && bundleHandler != null) bundleHandler.onResult(data);
    }
    @Override
    public void onError(String message, Bundle data) {
      logControlRequestError(intent, message, data);
      int errorCode = 0;
      if (data != null) {
        errorCode = data.getInt(CastMediaControlIntent.EXTRA_ERROR_CODE);
      }
      sendErrorToListeners(errorCode);
      if (bundleHandler != null) bundleHandler.onError(message, data);
    }
  });
}
origin: derry/delion

@Override
public void onRouteChanged(MediaRouter router, RouteInfo route) {
  // We only care about changes to the current route.
  if (!route.equals(getCurrentRoute())) return;
  // When there is no wifi connection, this condition becomes true.
  if (route.isConnecting()) {
    // We don't want to post the same Runnable twice.
    if (!mConnectionFailureNotifierQueued) {
      mConnectionFailureNotifierQueued = true;
      getHandler().postDelayed(mConnectionFailureNotifier,
          CONNECTION_FAILURE_NOTIFICATION_DELAY_MS);
    }
  } else {
    // Only cancel the disconnect if we already posted the message. We can get into this
    // situation if we swap the current route provider (for example, switching to a YT
    // video while casting a non-YT video).
    if (mConnectionFailureNotifierQueued) {
      // We have reconnected, cancel the delayed disconnect.
      getHandler().removeCallbacks(mConnectionFailureNotifier);
      mConnectionFailureNotifierQueued = false;
    }
  }
}
origin: derry/delion

@Override
protected void onRouteSelectedEvent(MediaRouter router, RouteInfo route) {
  Log.d(TAG, "Selected route %s", route);
  if (!route.isSelected()) return;
  RecordCastAction.castPlayRequested();
  RecordCastAction.remotePlaybackDeviceSelected(
      RecordCastAction.DEVICE_TYPE_CAST_GENERIC);
  installBroadcastReceivers();
  if (getMediaStateListener() == null) {
    showCastError(route.getName());
    release();
    return;
  }
  if (route != getCurrentRoute()) {
    registerRoute(route);
    clearStreamState();
  }
  mPositionExtrapolator.clear();
  notifyRouteSelected(route);
}
origin: googlesamples/android-MediaRouter

public static Player create(Context context, RouteInfo route) {
  Player player;
  if (route != null && route.supportsControlCategory(
      MediaControlIntent.CATEGORY_REMOTE_PLAYBACK)) {
    player = new RemotePlayer(context);
  } else if (route != null) {
    player = new LocalPlayer.SurfaceViewPlayer(context);
  } else {
    player = new LocalPlayer.OverlayPlayer(context);
  }
  player.connect(route);
  return player;
}
origin: derry/delion

@Override
public final String getRouteName() {
  return mCurrentRoute == null ? null : mCurrentRoute.getName();
}
origin: derry/delion

/**
 * Reset the media route to the default
 */
protected void clearMediaRoute() {
  if (getMediaRouter() != null) {
    getMediaRouter().getDefaultRoute().select();
    registerRoute(getMediaRouter().getDefaultRoute());
  }
}
origin: derry/delion

protected void sendErrorToListeners(int error) {
  String errorMessage =
      getContext().getString(R.string.cast_error_playing_video, mCurrentRoute.getName());
  for (UiListener listener : mUiListeners) {
    listener.onError(error, errorMessage);
  }
  if (mMediaStateListener != null) mMediaStateListener.onError();
}
origin: derry/delion

@Override
public final boolean isRemotePlaybackAvailable() {
  if (mediaRouterInitializationFailed()) return false;
  return getMediaRouter().getSelectedRoute().getPlaybackType()
      == MediaRouter.RouteInfo.PLAYBACK_TYPE_REMOTE || getMediaRouter().isRouteAvailable(
      mMediaRouteSelector, MediaRouter.AVAILABILITY_FLAG_IGNORE_DEFAULT_ROUTE);
}
origin: derry/delion

@Override
public boolean currentRouteSupportsRemotePlayback() {
  return mCurrentRoute != null && mCurrentRoute.supportsControlCategory(
      MediaControlIntent.CATEGORY_REMOTE_PLAYBACK);
}
origin: derry/delion

@Override
protected void onRouteUnselectedEvent(MediaRouter router, RouteInfo route) {
  Log.d(TAG, "Unselected route %s", route);
  // Preserve our best guess as to the final position; this is needed to reset the
  // local position while switching back to local playback.
  mPositionExtrapolator.onPaused();
  if (getCurrentRoute() != null && route.getId().equals(getCurrentRoute().getId())) {
    clearStreamState();
  }
}
origin: derry/delion

protected final void notifyRouteSelected(RouteInfo route) {
  for (UiListener listener : mUiListeners) {
    listener.onRouteSelected(route.getName(), this);
  }
  if (!canCastMedia()) return;
  if (mMediaStateListener == null) return;
  mMediaStateListener.pauseLocal();
  mMediaStateListener.onCastStarting(route.getName());
  startCastingVideo();
}
origin: derry/delion

  @Override
  public void onRouteUnselected(MediaRouter router, RouteInfo route) {
    onRouteUnselectedEvent(router, route);
    if (getCurrentRoute() != null && !getCurrentRoute().isDefault()
        && route.getId().equals(getCurrentRoute().getId())) {
      RecordCastAction.castEndedTimeRemaining(getDuration(),
          getDuration() - getPosition());
      release();
    }
  }
}
origin: derry/delion

@Override
public void setRemoteVolume(int delta) {
  boolean canChangeRemoteVolume = (getCurrentRoute().getVolumeHandling()
      == MediaRouter.RouteInfo.PLAYBACK_VOLUME_VARIABLE);
  if (currentRouteSupportsRemotePlayback() && canChangeRemoteVolume) {
    getCurrentRoute().requestUpdateVolume(delta);
  }
}
origin: derry/delion

/**
 * @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()));
}
origin: derry/delion

@RemovableInRelease
private void logRoute(String message, RouteInfo route) {
  if (route != null) {
    Log.d(TAG, message + " " + route.getName() + " " + route.getId());
  }
}
origin: googlesamples/android-MediaRouter

private void updateRouteDescription() {
  RouteInfo route = mMediaRouter.getSelectedRoute();
  mInfoTextView.setText(
      "Currently selected route:" + "\nName: " + route.getName() + "\nProvider: " +
          route.getProvider().getPackageName() + "\nDescription: " +
          route.getDescription() + "\nStatistics: " +
          mSessionManager.getStatistics());
}
android.support.v7.mediaMediaRouter$RouteInfo

Most used methods

  • getName
  • getDescription
  • getId
  • getPlaybackType
  • getVolumeHandling
  • isConnecting
  • isSelected
  • select
  • sendControlRequest
  • supportsControlCategory
  • supportsControlRequest
  • getExtras
  • supportsControlRequest,
  • getExtras,
  • getPlaybackStream,
  • getPresentationDisplay,
  • getProvider,
  • getVolume,
  • getVolumeMax,
  • isDefault,
  • isEnabled,
  • matchesSelector

Popular in Java

  • Making http requests using okhttp
  • runOnUiThread (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • setRequestProperty (URLConnection)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • Locale (java.util)
    Locale represents a language/country/variant combination. Locales are used to alter the presentatio
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • JOptionPane (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now