AddonSession

@PublicApi
public interface AddonSession



Uma sessão complementar.

Contém métodos comuns a todas as sessões complementares. Para acessar os recursos "Assistir em grupo" e "Cofazer", chame getCoWatching e getCoDoing, respectivamente.

Resumo

Tipos aninhados

Um builder para a classe AddonSession.

Motivos para o cliente do complemento encerrar a sessão do complemento.

Métodos públicos

abstract ListenableFuture<Void>

Encerra a sessão do complemento e desconecta o app Meet.

abstract ListenableFuture<Void>

Encerra a sessão do complemento, desconecta o app Meet e informa o motivo.

abstract void

Sai do estado suspenso.

abstract CoDoingClient

Retorna a instância CoDoingClient.

abstract CoWatchingClient

Retorna a instância CoWatchingClient.

abstract AddonMeetingInfo

Retorna informações sobre a reunião conectada, como o URL.

abstract boolean

Retornará true se a sessão tiver terminado.

abstract boolean

Indica se a sessão está suspensa.

abstract void

Redefine o estado inicial do complemento.

abstract void

Suspende a sessão do complemento.

abstract void

Atualiza o estado inicial do complemento.

abstract void
updateParticipantMetadata(byte[] metadata)

Atualiza os metadados deste participante.

Métodos públicos

endSession

abstract ListenableFuture<VoidendSession()

Encerra a sessão do complemento e desconecta o app Meet. Isso não força o Meet a encerrar a reunião nem faz com que o usuário saia.

Se a sessão já terminou, isso é um ambiente autônomo, ou seja, não gera uma exceção.

Retorna
ListenableFuture<Void>

Uma ListenableFuture que avalia sucesso ou uma AddonException em caso de erro inesperado

endSession

abstract ListenableFuture<VoidendSession(AddonSession.EndReason endReason)

Encerra a sessão do complemento, desconecta o app Meet e informa o motivo. Isso não força o Meet a encerrar a reunião nem faz com que o usuário saia.

O Meet pode realizar as ações correspondentes acordadas com o cliente do complemento com base no motivo.

Se a sessão já terminou, isso é um ambiente autônomo, ou seja, não gera uma exceção.

Essa informação é visível apenas para os clientes de complementos autorizados a encerrar a sessão com um motivo.

Esse método retornaria o mesmo resultado que endSession if the EndReason is UNKNOWN or not valid.

Parameters
AddonSession.EndReason endReason

The reason for the add-onclient to end the add-on session.

Returns
ListenableFuture<Void>

a ListenableFuture which evaluates to success or an AddonException

endSuspension

abstract void endSuspension()

Exits the state of suspended. The add-on app is once again able to send and receive updates.

If the this is not in a state of suspended, this is a no-op.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

getCoDoing

abstract CoDoingClient getCoDoing()

Returns the CoDoingClient instance.

Throws
java.lang.IllegalStateException

if the session was built without calling withCoDoing or if the session has ended

getCoWatching

abstract CoWatchingClient getCoWatching()

Returns the CoWatchingClient instance.

Throws
java.lang.IllegalStateException

if the session was built without calling withCoWatching or if the session has ended

getMeetingInfo

abstract AddonMeetingInfo getMeetingInfo()

Returns information about the connected meeting, such as the meeting URL.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

isSessionEnded

abstract boolean isSessionEnded()

Returns true if the session has ended. This could either be from an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded

isSuspended

abstract boolean isSuspended()

Indicates whether the session is suspended. See suspend and endSuspension.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

resetCollaborationStartingState

abstract void resetCollaborationStartingState()

Resets the starting state of the add-on. This will clear the starting state previously received by other participants. The starting state can only be reset by the initiator.

suspend

abstract void suspend()

Suspends the add-on session. This does NOT disconnect from the Meet app. This causes the SDK to avoid sending updates to your CoDoingHandler and CoWatchingHandler, and causes the SDK to ignore calls to notify calls and to ignore calls to update the global state.

If the session is already suspended, this is a no-op.

For example, you may choose to call suspend when a user, but not every user, has playback interrupted to view an ad, when a user backgrounds the application, etc.

Throws
java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.

updateCollaborationStartingState

abstract void updateCollaborationStartingState(
    CollaborationStartingState startingState
)

Updates the starting state of the add-on. This is received by other participants when they accept the invitation to collaborate. The starting state can only be updated by the initiator.

Parameters
CollaborationStartingState startingState

the starting state of add-on

updateParticipantMetadata

abstract void updateParticipantMetadata(byte[] metadata)

Updates the metadata for this participant.

To receive metadata from other participants, a handler must be registered by calling withParticipantMetadata while building the AddonSession.

The encoded metadata is capped at MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes per participant.

Parameters
byte[] metadata

an encoded blob of metadata that describes relevant metadata for the local participant

Throws
java.lang.IllegalArgumentException

if the provided metadata exceeds MAX_INDIVIDUAL_PARTICIPANT_METADATA_SIZE_BYTES bytes

java.lang.IllegalStateException

if the session has ended. This could either be an explicit call to endSession or it could be due to an external reason which would be surfaced via onSessionEnded.