本文整理汇总了Java中android.support.v7.media.MediaRouter.RouteInfo类的典型用法代码示例。如果您正苦于以下问题:Java RouteInfo类的具体用法?Java RouteInfo怎么用?Java RouteInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RouteInfo类属于android.support.v7.media.MediaRouter包,在下文中一共展示了RouteInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onRouteSelectedEvent
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@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);
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:26,代码来源:DefaultMediaRouteController.java
示例2: onRouteChanged
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@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;
}
}
}
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:24,代码来源:AbstractMediaRouteController.java
示例3: reconnectSessionIfPossibleInternal
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
private void reconnectSessionIfPossibleInternal(RouteInfo theRoute) {
if (isConnected()) {
return;
}
String sessionId = mPreferenceAccessor.getStringFromPreference(PREFS_KEY_SESSION_ID);
String routeId = mPreferenceAccessor.getStringFromPreference(PREFS_KEY_ROUTE_ID);
LOGD(TAG, "reconnectSessionIfPossible() Retrieved from preferences: " + "sessionId="
+ sessionId + ", routeId=" + routeId);
if (sessionId == null || routeId == null) {
return;
}
setReconnectionStatus(RECONNECTION_STATUS_IN_PROGRESS);
CastDevice device = CastDevice.getFromBundle(theRoute.getExtras());
if (device != null) {
LOGD(TAG, "trying to acquire Cast Client for " + device);
onDeviceSelected(device, theRoute);
}
}
示例4: onRouteSelected
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public void onRouteSelected(MediaRouter router, RouteInfo info) {
LOGD(TAG, "onRouteSelected: info=" + info);
if (mCastManager.getReconnectionStatus()
== BaseCastManager.RECONNECTION_STATUS_FINALIZED) {
mCastManager.setReconnectionStatus(BaseCastManager.RECONNECTION_STATUS_INACTIVE);
mCastManager.cancelReconnectionTask();
return;
}
mCastManager.getPreferenceAccessor().saveStringToPreference(
BaseCastManager.PREFS_KEY_ROUTE_ID, info.getId());
CastDevice device = CastDevice.getFromBundle(info.getExtras());
mCastManager.onDeviceSelected(device, info);
LOGD(TAG, "onRouteSelected: mSelectedDevice=" + (device != null ? device.getFriendlyName()
: "Null"));
}
示例5: onRouteAdded
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public void onRouteAdded(MediaRouter router, RouteInfo routeInfo) {
if (!router.getDefaultRoute().equals(routeInfo)) {
notifyRouteAvailabilityChangedIfNeeded(router);
mCastManager.onCastDeviceDetected(routeInfo);
}
if (mCastManager.getReconnectionStatus()
== BaseCastManager.RECONNECTION_STATUS_STARTED) {
String routeId = mCastManager.getPreferenceAccessor().getStringFromPreference(
BaseCastManager.PREFS_KEY_ROUTE_ID);
if (routeInfo.getId().equals(routeId)) {
// we found the route, so lets go with that
LOGD(TAG, "onRouteAdded: Attempting to recover a session with info=" + routeInfo);
mCastManager.setReconnectionStatus(BaseCastManager.RECONNECTION_STATUS_IN_PROGRESS);
CastDevice device = CastDevice.getFromBundle(routeInfo.getExtras());
LOGD(TAG, "onRouteAdded: Attempting to recover a session with device: "
+ (device != null ? device.getFriendlyName() : "Null"));
mCastManager.onDeviceSelected(device, routeInfo);
}
}
}
示例6: onRouteRemoved
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public void onRouteRemoved(final MediaRouter router, final RouteInfo route) {
super.onRouteRemoved(router, route);
CastDevice castDevice = CastDevice.getFromBundle(route.getExtras());
String uuid = castDevice.getDeviceId();
removedUUID.add(uuid);
// Prevent immediate removing. There are some cases when service is removed and added
// again after a second.
if (removeRoutesTimer == null) {
removeRoutesTimer = new Timer();
removeRoutesTimer.schedule(new TimerTask() {
@Override
public void run() {
removeServices(route);
}
}, ROUTE_REMOVE_INTERVAL);
}
}
示例7: removeServices
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
private void removeServices(RouteInfo route) {
for (String uuid : removedUUID) {
final ServiceDescription service = foundServices.get(uuid);
if (service != null) {
Log.d(Util.T, "Service [" + route.getName() + "] has been removed");
Util.runOnUI(new Runnable() {
@Override
public void run() {
for (DiscoveryProviderListener listener : serviceListeners) {
listener.onServiceRemoved(CastDiscoveryProvider.this, service);
}
}
});
foundServices.remove(uuid);
}
}
removedUUID.clear();
}
示例8: reconnectAnyExistingRoute
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public boolean reconnectAnyExistingRoute() {
String deviceId = RemotePlaybackSettings.getDeviceId(getContext());
RouteInfo defaultRoute = getMediaRouter().getDefaultRoute();
if (deviceId == null || deviceId.equals(defaultRoute.getId()) || !shouldReconnect()) {
RemotePlaybackSettings.setShouldReconnectToRemote(getContext(), false);
return false;
}
mReconnecting = true;
selectDevice(deviceId);
getHandler().postDelayed(new Runnable() {
@Override
public void run() {
if (mReconnecting) {
Log.d(TAG, "Reconnection timed out");
// We have been trying to reconnect for too long. Give up and save battery.
mReconnecting = false;
release();
}
}
}, CONNECTION_FAILURE_NOTIFICATION_DELAY_MS);
return true;
}
示例9: selectDevice
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的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;
}
}
}
}
示例10: reconnectSessionIfPossibleInternal
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
private void reconnectSessionIfPossibleInternal(RouteInfo theRoute) {
if (isConnected()) {
onReconnectionStatusChanged(RECONNECTION_SUCCESSFUL);
return;
}
String sessionId = Utils.getStringFromPreference(mContext, PREFS_KEY_SESSION_ID);
String routeId = Utils.getStringFromPreference(mContext, PREFS_KEY_ROUTE_ID);
LOGD(TAG, "reconnectSessionIfPossible() Retrieved from preferences: " + "sessionId="
+ sessionId + ", routeId=" + routeId);
if (null == sessionId || null == routeId) {
return;
}
mReconnectionStatus = ReconnectionStatus.IN_PROGRESS;
CastDevice device = CastDevice.getFromBundle(theRoute.getExtras());
if (null != device) {
LOGD(TAG, "trying to acquire Cast Client for " + device);
onDeviceSelected(device);
}
}
示例11: onRouteAdded
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
public void onRouteAdded(MediaRouter router, RouteInfo route) {
super.onRouteAdded(router, route);
routes.add(route);
System.out.println("route added :"+route.getId()+":"+route.getName()+":"+route.getDescription());
if (receiverCallback != null) {
JSONObject jsonRoute = new JSONObject();
try {
jsonRoute.put("id", route.getId());
jsonRoute.put("name", route.getName());
jsonRoute.put("description", route.getDescription());
jsonRoute.put("index", routes.size() - 1);
} catch (JSONException e) {
}
PluginResult result = new PluginResult(PluginResult.Status.OK, jsonRoute);
result.setKeepCallback(true);
receiverCallback.sendPluginResult(result);
}
}
示例12: reconnectSessionIfPossibleInternal
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
private void reconnectSessionIfPossibleInternal(RouteInfo theRoute) {
if (isConnected()) {
return;
}
String sessionId = CastUtils.getStringFromPreference(mContext, PREFS_KEY_SESSION_ID);
String routeId = CastUtils.getStringFromPreference(mContext, PREFS_KEY_ROUTE_ID);
CastUtils.LOGD(TAG, "reconnectSessionIfPossible() Retrieved from preferences: " + "sessionId=" + sessionId + ", routeId=" + routeId);
if (null == sessionId || null == routeId) {
return;
}
mReconnectionStatus = ReconnectionStatus.IN_PROGRESS;
CastDevice device = CastDevice.getFromBundle(theRoute.getExtras());
if (null != device) {
CastUtils.LOGD(TAG, "trying to acquire Cast Client for " + device);
onDeviceSelected(device);
}
}
示例13: onRouteAdded
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public void onRouteAdded(MediaRouter router, RouteInfo route) {
super.onRouteAdded(router, route);
if (!router.getDefaultRoute().equals(route)) {
selectDeviceInterface.onCastDeviceDetected(route);
}
if (BaseCastManager.getCastManager().getReconnectionStatus() == ReconnectionStatus.STARTED) {
String routeId = CastUtils.getStringFromPreference(mContext, BaseCastManager.PREFS_KEY_ROUTE_ID);
if (route.getId().equals(routeId)) {
// we found the route, so lets go with that
CastUtils.LOGD(TAG, "onRouteAdded: Attempting to recover a session with info=" + route);
BaseCastManager.getCastManager().setReconnectionStatus(ReconnectionStatus.IN_PROGRESS);
CastDevice device = CastDevice.getFromBundle(route.getExtras());
CastUtils.LOGD(TAG, "onRouteAdded: Attempting to recover a session with device: " + device.getFriendlyName());
selectDeviceInterface.onDeviceSelected(device);
}
}
}
示例14: reconnectSessionIfPossibleInternal
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
private void reconnectSessionIfPossibleInternal(RouteInfo theRoute) {
if (isConnected()) {
return;
}
String sessionId = Utils.getStringFromPreference(mContext, PREFS_KEY_SESSION_ID);
String routeId = Utils.getStringFromPreference(mContext, PREFS_KEY_ROUTE_ID);
LOGD(TAG, "reconnectSessionIfPossible() Retrieved from preferences: " + "sessionId="
+ sessionId + ", routeId=" + routeId);
if (null == sessionId || null == routeId) {
return;
}
mReconnectionStatus = ReconnectionStatus.IN_PROGRESS;
CastDevice device = CastDevice.getFromBundle(theRoute.getExtras());
if (null != device) {
LOGD(TAG, "trying to acquire Cast Client for " + device);
onDeviceSelected(device);
}
}
示例15: onRouteAdded
import android.support.v7.media.MediaRouter.RouteInfo; //导入依赖的package包/类
@Override
public void onRouteAdded(MediaRouter router, RouteInfo route) {
super.onRouteAdded(router, route);
if (!router.getDefaultRoute().equals(route)) {
if (++mRouteCount == 1) {
BaseCastManager.getCastManager().onCastAvailabilityChanged(true);
}
selectDeviceInterface.onCastDeviceDetected(route);
}
if (BaseCastManager.getCastManager().getReconnectionStatus() == ReconnectionStatus.STARTED) {
String routeId = Utils.getStringFromPreference(mContext,
BaseCastManager.PREFS_KEY_ROUTE_ID);
if (route.getId().equals(routeId)) {
// we found the route, so lets go with that
LOGD(TAG, "onRouteAdded: Attempting to recover a session with info=" + route);
BaseCastManager.getCastManager().setReconnectionStatus(
ReconnectionStatus.IN_PROGRESS);
CastDevice device = CastDevice.getFromBundle(route.getExtras());
LOGD(TAG, "onRouteAdded: Attempting to recover a session with device: "
+ device.getFriendlyName());
selectDeviceInterface.onDeviceSelected(device);
}
}
}