CoWatchingClient

@PublicApi
public interface CoWatchingClient



Represents a co-watching session.

Informs Meet of recent user actions (e.g. play/pause/seek) and environmental factors like delays due to buffering media.

Summary

Constants

default static final double

Maximum allowed playout rate.

default static final double

Maximum number of seeks allowed per second.

Public methods

abstract void
notifyBuffering(Duration mediaPlayoutPosition)

Notifies Meet that the media is not ready to be played out due to buffering, due to a prior media switch, media seek, or normal network congestion.

abstract void
notifyEnded(Duration mediaPlayoutPosition)

Notifies Meet that the media player has reached the end of the current media.

abstract void
notifyPauseState(boolean paused, Duration mediaPlayoutPosition)

Notify Meet that the user has paused or unpaused the playback of media, so Meet can mirror that action for other users.

abstract void
notifyPlayoutRate(double rate, Duration mediaPlayoutPosition)

Notifies Meet that user has updated the playout rate of the media (eg.

abstract void

Notify Meet that the queue has changed, so Meet can mirror that for other users.

abstract void
notifyReady(Duration mediaPlayoutPosition)

Notifies Meet that the buffering is complete and the media is now ready to be played out, starting at the supplied timestamp.

abstract void
notifySeekToTimestamp(Duration mediaPlayoutPosition)

Notify Meet that the user has seeked the playback point of the media, so Meet can mirror that action for other users.

abstract void
notifySwitchedToMedia(
    String mediaTitle,
    String mediaId,
    Duration mediaPlayoutPosition
)

Notify Meet that the user has switched media, so Meet can pass that along to other users.

abstract void
notifySwitchedToMedia(
    String mediaTitle,
    String mediaId,
    Duration mediaPlayoutPosition,
    CoWatchingQueue queue
)

Notify Meet that the user has switched media, with a simulatenous queue update, so Meet can pass that along to other users.

Constants

MAX_PLAYOUT_RATE

default static final double MAX_PLAYOUT_RATE = 2.0

Maximum allowed playout rate.

MAX_SEEKS_PER_SECOND

default static final double MAX_SEEKS_PER_SECOND = 0.9

Maximum number of seeks allowed per second.

Public methods

notifyBuffering

abstract void notifyBuffering(Duration mediaPlayoutPosition)

Notifies Meet that the media is not ready to be played out due to buffering, due to a prior media switch, media seek, or normal network congestion.

Parameters
Duration mediaPlayoutPosition

the position at which the media is paused, waiting for buffering to complete

Throws
java.lang.NullPointerException

if mediaPlayoutPosition is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifyEnded

abstract void notifyEnded(Duration mediaPlayoutPosition)

Notifies Meet that the media player has reached the end of the current media.

Note: calling this method is not required (though not harmful) if notifySwitchedToMedia is called via an auto-play mechanism as soon as a media ends.

Parameters
Duration mediaPlayoutPosition

the final position of the player

Throws
java.lang.NullPointerException

if mediaPlayoutPosition is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifyPauseState

abstract void notifyPauseState(boolean paused, Duration mediaPlayoutPosition)

Notify Meet that the user has paused or unpaused the playback of media, so Meet can mirror that action for other users.

Parameters
boolean paused

true if paused or false if playback resumed

Duration mediaPlayoutPosition

the position at which the media was paused or unpaused

Throws
java.lang.NullPointerException

if mediaPlayoutPosition is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifyPlayoutRate

abstract void notifyPlayoutRate(double rate, Duration mediaPlayoutPosition)

Notifies Meet that user has updated the playout rate of the media (eg. 1.25x) to a new value.

Parameters
double rate

the rate at which media is now being played out

Duration mediaPlayoutPosition

the current position of the player

Throws
java.lang.IllegalStateException

if rate is not a positive number

java.lang.IllegalStateException

if rate is greater than the MAX_PLAYOUT_RATE

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifyQueueUpdate

abstract void notifyQueueUpdate(CoWatchingQueue queue)

Notify Meet that the queue has changed, so Meet can mirror that for other users.

Parameters
CoWatchingQueue queue

info about the queue of the add-on app

Throws
java.lang.NullPointerException

if queue is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifyReady

abstract void notifyReady(Duration mediaPlayoutPosition)

Notifies Meet that the buffering is complete and the media is now ready to be played out, starting at the supplied timestamp.

Parameters
Duration mediaPlayoutPosition

the position at which the media is buffered and ready to play

Throws
java.lang.NullPointerException

if mediaPlayoutPosition is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifySeekToTimestamp

abstract void notifySeekToTimestamp(Duration mediaPlayoutPosition)

Notify Meet that the user has seeked the playback point of the media, so Meet can mirror that action for other users.

Parameters
Duration mediaPlayoutPosition

the timestamp to which the user seeked

Throws
java.lang.NullPointerException

if mediaPlayoutPosition is null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

java.lang.IllegalStateException

if the number of seeks per second is greater than MAX_SEEKS_PER_SECOND

notifySwitchedToMedia

abstract void notifySwitchedToMedia(
    String mediaTitle,
    String mediaId,
    Duration mediaPlayoutPosition
)

Notify Meet that the user has switched media, so Meet can pass that along to other users.

Parameters
String mediaTitle

the title of the media switched to. This title will be reflected in the Meet UI when other users are considering connecting to the co-watching session.

String mediaId

the string URI of the media switched to

Duration mediaPlayoutPosition

the position at which the media began playout

Throws
java.lang.NullPointerException

if mediaId or mediaPlayoutPosition are null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended

notifySwitchedToMedia

abstract void notifySwitchedToMedia(
    String mediaTitle,
    String mediaId,
    Duration mediaPlayoutPosition,
    CoWatchingQueue queue
)

Notify Meet that the user has switched media, with a simulatenous queue update, so Meet can pass that along to other users.

Parameters
String mediaTitle

the title of the media switched to. This title will be reflected in the Meet UI when other users are considering connecting to the co-watching session.

String mediaId

the string URI of the media switched to

Duration mediaPlayoutPosition

the position at which the media began playout

CoWatchingQueue queue

info about the queue of the add-on app

Throws
java.lang.NullPointerException

if mediaId, mediaPlayoutPosition, or queue are null

com.google.android.meet.addons.AddonException

if there was an unexpected error

java.lang.IllegalStateException

if called after the co-watching session has ended