The Google Meet Live Sharing SDK is in preview. Developers can apply for access through our Early Access Program.

LiveSharingClient

public interface LiveSharingClient

Primary interface for starting and stopping live sharing with Meet as the live video provider.

Note: Methods must be called in the documented order, else the returned ListenableFuture will resolve with an IllegalStateException. For example, disconnectMeeting() should not be called before connectMeeting(Context, String, MeetingDisconnectHandler). However, as long as these methods are called in the correct order, it's not necessary (although recommended) to wait for the ListenableFuture of the first method to resolve before calling the second method. Additionally, it's not recommended to call Future.cancel(boolean) on these futures, but instead to permit them to run to completion.

Sample usage:

class AwesomeVideoMeetingDisconnectUpdateHandler implements MeetingDisconnectHandler {}

class AwesomeVideoCoWatchingSessionDelegate implements CoWatchingSessionDelegate {}

public ListenableFuture<CoWatching> initialSetup() {
  LiveSharingClient meetClient = LiveSharingClientFactory.getClient();

  ListenableFuture<LiveSharingMeetingInfo> meetingInfoFuture =
      meetClient.connectMeeting(
          appContext,
          "AwesomeVideoApp", // liveSharingApplicationName
          new AwesomeVideoMeetingDisconnectUpdateHandler());

  return Futures.transformAsync(
      meetingInfoFuture,
      (LiveSharingMeetingInfo meetingInfo) -> {
        this.meetingInfo = meetingInfo;
        return meetClient.beginCoWatching(new AwesomeVideoCoWatchingSessionDelegate());
      },
      executor);
}

Public Method Summary

abstract ListenableFuture<CoDoingSession>
abstract ListenableFuture<CoWatchingSession>
abstract ListenableFuture<LiveSharingMeetingInfo>
connectMeeting(Context appContext, String liveSharingApplicationName, MeetingDisconnectHandler meetingDisconnectHandler)
Connects to a meeting, either by creating a meeting or by connecting to an ongoing meeting.
abstract ListenableFuture<Void>
disconnectMeeting()
Disconnects the user from the connected meeting, but does not force Meet to end the meeting.
abstract ListenableFuture<Void>
endCoDoing()
Ends the current CoDoingSession.
abstract ListenableFuture<Void>
abstract ListenableFuture<LiveSharingMeetingInfo>
queryMeeting(Context appContext, Optional<Handler> handler)
Returns the status of ongoing Meet sessions, if any.

Public Methods

public abstract ListenableFuture<CoDoingSession> beginCoDoing (CoDoingSessionDelegate delegate)

Begins a CoDoingSession.

Note: Only one co-doing session can be active at one time.

Returns
Throws
NullPointerException if delegate is null.

public abstract ListenableFuture<CoWatchingSession> beginCoWatching (CoWatchingSessionDelegate delegate)

Begins a CoWatchingSession.

Note: Only one co-watching session can be active at one time.

Returns
Throws
NullPointerException if delegate is null.

public abstract ListenableFuture<LiveSharingMeetingInfo> connectMeeting (Context appContext, String liveSharingApplicationName, MeetingDisconnectHandler meetingDisconnectHandler)

Connects to a meeting, either by creating a meeting or by connecting to an ongoing meeting.

If a meeting is created, the current user will be the only participant initially.

The returned URL is intended to be exposed to the user to be manually shared with their intended live sharing group.

If this method is called before calling disconnectMeeting() for an existing meeting, the future will fail with an IllegalStateException.

Parameters
appContext the Context.getApplicationContext() value of the application that is using the Meet Live Sharing SDK.
liveSharingApplicationName the globally-unique canonical name for the Live Sharing App connecting to Meet, e.g. youtube.
meetingDisconnectHandler a MeetingDisconnectHandler to receive notification when the Meet client has disconnected.
Returns
Throws
NullPointerException if any of the provided arguments are null.
IllegalStateException if liveSharingApplicationName is an empty string or isn't part of the onboarded list of Apps.

public abstract ListenableFuture<Void> disconnectMeeting ()

Disconnects the user from the connected meeting, but does not force Meet to end the meeting.

Returns

public abstract ListenableFuture<Void> endCoDoing ()

Ends the current CoDoingSession.

Returns

public abstract ListenableFuture<Void> endCoWatching ()

Ends the current CoWatchingSession.

Returns

public abstract ListenableFuture<LiveSharingMeetingInfo> queryMeeting (Context appContext, Optional<Handler> handler)

Returns the status of ongoing Meet sessions, if any. This is a single, one-time check.

Utilized to detect any ongoing Meet standalone or live sharing sessions. In the event of detected active sessions, will return LiveSharingMeetingInfo with the LiveSharingMeetingInfo.MeetingStatus member set as LiveSharingMeetingInfo.MeetingStatus.CONNECTED or LiveSharingMeetingInfo.MeetingStatus.CONNECTED_WITH_LIVE_SHARING. No active session returns LiveSharingMeetingInfo.MeetingStatus.NOT_CONNECTED

Accepts Optional of Handler as parameter for application controlled thread management. In the absence of Handler, one will be spawned during execution. Only allow this if you do not care to have control over the Handler instance.

Parameters
appContext the Context.getApplicationContext() value of the application that is using the Meet Live Sharing SDK.
handler an Optional of Handler for asynchronous execution
Returns