@Override public void onResult(ApplicationConnectionResult result) { Status status = result.getStatus(); if (status.isSuccess()) { try { ApplicationMetadata metadata = result.getApplicationMetadata(); ChromecastSession.this.sessionId = result.getSessionId(); ChromecastSession.this.displayName = metadata.getName(); ChromecastSession.this.appImages = metadata.getImages(); ChromecastSession.this.joinSessionCallback.onSuccess(ChromecastSession.this); connectRemoteMediaPlayer(); ChromecastSession.this.isConnected = true; } catch (IllegalStateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { ChromecastSession.this.joinSessionCallback.onError(status.toString()); ChromecastSession.this.isConnected = false; } }
static void a(ApplicationMetadata applicationMetadata, Parcel parcel, int n) { int n2 = b.D(parcel); b.c(parcel, 1, applicationMetadata.getVersionCode()); b.a(parcel, 2, applicationMetadata.getApplicationId(), false); b.a(parcel, 3, applicationMetadata.getName(), false); b.c(parcel, 4, applicationMetadata.getImages(), false); b.b(parcel, 5, applicationMetadata.EB, false); b.a(parcel, 6, applicationMetadata.getSenderAppIdentifier(), false); b.a(parcel, 7, applicationMetadata.fu(), n, false); b.H(parcel, n2); }
@Override public CastSessionInfo getSessionInfo() { if (isApiClientInvalid()) return null; CastSessionInfo.VolumeInfo.Builder volumeBuilder = new CastSessionInfo.VolumeInfo.Builder() .setLevel(Cast.CastApi.getVolume(mApiClient)) .setMuted(Cast.CastApi.isMute(mApiClient)); CastSessionInfo.ReceiverInfo.Builder receiverBuilder = new CastSessionInfo.ReceiverInfo.Builder() .setLabel(mCastDevice.getDeviceId()) .setFriendlyName(mCastDevice.getFriendlyName()) .setVolume(volumeBuilder.build()) .setIsActiveInput(Cast.CastApi.getActiveInputState(mApiClient)) .setDisplayStatus(null) .setReceiverType("cast") .addCapabilities(getCapabilities(mCastDevice)); CastSessionInfo.Builder sessionInfoBuilder = new CastSessionInfo.Builder() .setSessionId(mSessionId) .setStatusText(mApplicationStatus) .setReceiver(receiverBuilder.build()) .setStatus("connected") .setTransportId("web-4") .addNamespaces(mNamespaces); if (mApplicationMetadata != null) { sessionInfoBuilder .setAppId(mApplicationMetadata.getApplicationId()) .setDisplayName(mApplicationMetadata.getName()); } else { sessionInfoBuilder .setAppId(mSource.getApplicationId()) .setDisplayName(mCastDevice.getFriendlyName()); } return sessionInfoBuilder.build(); }