API reference

Cowatching Class

The Cowatching API provides a set of methods for managing cowatching sessions in a shared virtual home environment. It allows users to request to present, resign from presenting, join or leave a session, check if they are in a session com.meta.horizon.platform.ovr.models.CowatchingState#getInSession(), set and get presenter data, set and get viewer data, and launch an invite dialog.

Static Methods

getPresenterData ()
Retrieve the presenter data that drives an active cowatching session. This method can be called when there is an ongoing cowatching session, allowing developers to access and utilize the presenter data to enhance the user experience.
Signature
static Request<String> com.meta.horizon.platform.ovr.requests.Cowatching.getPresenterData()
Returns
Request< String >
getViewersData ()
Retrieve the viewer data of everyone who is in a cowatching session whose data was set by com.meta.horizon.platform.ovr.requests.Cowatching#setViewerData(String viewerData) viewerData. This can be called when there is an active cowatching session.
Signature
static Request<com.meta.horizon.platform.ovr.models.CowatchViewerArray> com.meta.horizon.platform.ovr.requests.Cowatching.getViewersData()
isInSession ()
Check whether the current user is participating in the ongoing cowatching session. It returns a boolean value com.meta.horizon.platform.ovr.models.CowatchingState#getInSession() indicating the user's presence in the session.
Signature
static Request<com.meta.horizon.platform.ovr.models.CowatchingState> com.meta.horizon.platform.ovr.requests.Cowatching.isInSession()
joinSession ()
Join the ongoing cowatching session as a viewer, updating data only possible for users already in the session.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.joinSession()
Returns
Request
launchInviteDialog ()
Launch a dialog for inviting users to cowatch in Copresent Home.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.launchInviteDialog()
Returns
Request
leaveSession ()
Leave the current cowatching session, rendering viewer data obsolete and no longer relevant to the ongoing experience.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.leaveSession()
Returns
Request
requestToPresent ()
Request to initiate a cowatching session as the presenter while being copresent in a shared virtual home environment.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.requestToPresent()
Returns
Request
resignFromPresenting ()
Stop being the presenter and terminate the ongoing cowatching session. This action will effectively end the shared media experience.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.resignFromPresenting()
Returns
Request
setApiNotReadyNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when the user is no longer in a copresent state and cowatching actions should not be performed.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setApiNotReadyNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setApiReadyNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when the user is in a copresent state and cowatching is ready to begin.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setApiReadyNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setInitializedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when the cowatching API has been initialized. At this stage, the API is not yet ready for use.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setInitializedNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setInSessionChangedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when the current user joins/leaves the cowatching session.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setInSessionChangedNotificationCallbacks(Request.Handler< CowatchingState > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< CowatchingState >
onError: Request.Handler< Error >
Returns
void
setPresenterData ( videoTitle , presenterData )
Set the data that drives a cowatching session. This method is only callable by the presenter. The video title cannot exceed 100 characters, and the data size is limited to 500 characters. The data will be eventually consistent across all users.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.setPresenterData(String videoTitle, String presenterData)
Parameters
videoTitle: String  - A string representing the title of the video being played in the cowatching session. This parameter must not exceed 100 characters in length.
presenterData: String  - A string containing data that drives the cowatching session, such as video metadata or playback information. This parameter is limited to 500 characters in length and will be eventually consistent across all users participating in the session.
Returns
Request
setPresenterDataChangedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when the presenter updates the presenter data.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setPresenterDataChangedNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setSessionStartedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when a user has started a cowatching session, and the ID of the session is reflected in the payload.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setSessionStartedNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setSessionStoppedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when a cowatching session has ended.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setSessionStoppedNotificationCallbacks(Request.Handler< String > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< String >
onError: Request.Handler< Error >
Returns
void
setViewerData ( viewerData )
Set the current user's viewer data to be shared with copresent users. This can be called when there is an active cowatching session. The data size is limited to 500 characters, and it will eventually become consistent across all users.
Signature
static Request com.meta.horizon.platform.ovr.requests.Cowatching.setViewerData(String viewerData)
Parameters
viewerData: String  - A string containing data about the current user's viewer state, such as their preferences or settings. This data is shared with copresent users during an active cowatching session and is limited to 500 characters in size. The data will eventually become consistent across all users participating in the session.
Returns
Request
setViewersDataChangedNotificationCallbacks ( onSuccess , onError )
Sets a callback function that will be triggered when a user joins or updates their viewer data.
Signature
static void com.meta.horizon.platform.ovr.requests.Cowatching.setViewersDataChangedNotificationCallbacks(Request.Handler< CowatchViewerUpdate > onSuccess, Request.Handler< Error > onError)
Parameters
onSuccess: Request.Handler< CowatchViewerUpdate >
onError: Request.Handler< Error >
Returns
void