CoWatchingClient

@PublicApi
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

const Double

Maximum allowed playout rate.

const Double

Maximum number of seeks allowed per second.

Public functions

Unit
notifyBuffering(mediaPlayoutPosition: Duration!)

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.

Unit
notifyEnded(mediaPlayoutPosition: Duration!)

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

Unit
notifyPauseState(paused: Boolean, mediaPlayoutPosition: Duration!)

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

Unit
notifyPlayoutRate(rate: Double, mediaPlayoutPosition: Duration!)

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

Unit

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

Unit
notifyReady(mediaPlayoutPosition: Duration!)

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

Unit
notifySeekToTimestamp(mediaPlayoutPosition: Duration!)

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

Unit
notifySwitchedToMedia(
    mediaTitle: String!,
    mediaId: String!,
    mediaPlayoutPosition: Duration!
)

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

Unit
notifySwitchedToMedia(
    mediaTitle: String!,
    mediaId: String!,
    mediaPlayoutPosition: Duration!,
    queue: CoWatchingQueue!
)

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

const val MAX_PLAYOUT_RATE = 2.0: Double

Maximum allowed playout rate.

MAX_SEEKS_PER_SECOND

const val MAX_SEEKS_PER_SECOND = 0.9: Double

Maximum number of seeks allowed per second.

Public functions

notifyBuffering

fun notifyBuffering(mediaPlayoutPosition: Duration!): Unit

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
mediaPlayoutPosition: Duration!

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

fun notifyEnded(mediaPlayoutPosition: Duration!): Unit

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
mediaPlayoutPosition: Duration!

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

fun notifyPauseState(paused: Boolean, mediaPlayoutPosition: Duration!): Unit

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

Parameters
paused: Boolean

true if paused or false if playback resumed

mediaPlayoutPosition: Duration!

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

fun notifyPlayoutRate(rate: Double, mediaPlayoutPosition: Duration!): Unit

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

Parameters
rate: Double

the rate at which media is now being played out

mediaPlayoutPosition: Duration!

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

fun notifyQueueUpdate(queue: CoWatchingQueue!): Unit

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

Parameters
queue: CoWatchingQueue!

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

fun notifyReady(mediaPlayoutPosition: Duration!): Unit

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

Parameters
mediaPlayoutPosition: Duration!

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

fun notifySeekToTimestamp(mediaPlayoutPosition: Duration!): Unit

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

Parameters
mediaPlayoutPosition: Duration!

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

fun notifySwitchedToMedia(
    mediaTitle: String!,
    mediaId: String!,
    mediaPlayoutPosition: Duration!
): Unit

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

Parameters
mediaTitle: String!

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.

mediaId: String!

the string URI of the media switched to

mediaPlayoutPosition: Duration!

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

fun notifySwitchedToMedia(
    mediaTitle: String!,
    mediaId: String!,
    mediaPlayoutPosition: Duration!,
    queue: CoWatchingQueue!
): Unit

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

Parameters
mediaTitle: String!

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.

mediaId: String!

the string URI of the media switched to

mediaPlayoutPosition: Duration!

the position at which the media began playout

queue: CoWatchingQueue!

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