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> |
endCoWatching()
Ends the current
CoWatchingSession .
|
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
- A
ListenableFuture
which evaluates to aCoDoingSession
instance if a co-doing session was successfully started; or to anIllegalStateException
if not connected to a meeting or if another co-doing session is still running (i.e.endCoDoing()
was not called); or to aLiveSharingException
if there was an unexpected error.
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
- A
ListenableFuture
which evaluates to aCoWatchingSession
instance if a co-watching session was successfully started; or to anIllegalStateException
if not connected to a meeting or if another co-watching session is still running (i.e.endCoWatching()
was not called); or to aLiveSharingException
if there was an unexpected error.
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
- A
ListenableFuture
which will resolve with aLiveSharingMeetingInfo
object if the connection was successful; or to anIllegalStateException
if already connected to a meeting (i.e.disconnectMeeting()
was not called); or to aLiveSharingException
if there was an unexpected error.
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
- A
ListenableFuture
which evaluates to success if the user successfully left the meeting; or to anIllegalStateException
if not connected to a meeting (i.e.connectMeeting(Context, String, MeetingDisconnectHandler)
was not called); or to aLiveSharingException
if there was an unexpected error.
public abstract ListenableFuture<Void> endCoDoing ()
Ends the current CoDoingSession
.
Returns
- A
ListenableFuture
which evaluates to success if the co-doing session successfully ended; or to anIllegalStateException
if not connected to a meeting or if there is no ongoing co-doing session (i.e.beginCoDoing(CoDoingSessionDelegate)
was not called); or to aLiveSharingException
if there was an unexpected error.
public abstract ListenableFuture<Void> endCoWatching ()
Ends the current CoWatchingSession
.
Returns
- A
ListenableFuture
which evaluates to success if the co-watching session successfully ended; or to anIllegalStateException
if not connected to a meeting or if there is no ongoing co-watching session (i.e.beginCoWatching(CoWatchingSessionDelegate)
was not called); or to aLiveSharingException
if there was an unexpected error.
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
- A
ListenableFuture
ofLiveSharingMeetingInfo
describing the status of the current meeting, if any.