API reference
API reference
Select your platform
No SDKs available
No versions available

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 CowatchingState::InSession, set and get presenter data, set and get viewer data, and launch an invite dialog.

Static Methods

GetNextCowatchViewerListPage ( list )
Signature
static Request<Models.CowatchViewerList> Oculus.Platform.Cowatching.GetNextCowatchViewerListPage(Models.CowatchViewerList list)
Parameters
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> Oculus.Platform.Cowatching.GetPresenterData()
Returns
Request< string >
GetViewersData ()
Retrieve the viewer data of everyone who is in a cowatching session whose data was set by Cowatching.SetViewerData() viewer_data. This can be called when there is an active cowatching session.
Signature
static Request<Models.CowatchViewerList> Oculus.Platform.Cowatching.GetViewersData()
IsInSession ()
Check whether the current user is participating in the ongoing cowatching session. It returns a boolean value CowatchingState::InSession indicating the user's presence in the session.
Signature
static Request<Models.CowatchingState> Oculus.Platform.Cowatching.IsInSession()
JoinSession ()
Join the ongoing cowatching session as a viewer, updating data only possible for users already in the session.
Signature
static Request Oculus.Platform.Cowatching.JoinSession()
Returns
Request
LaunchInviteDialog ()
Launch a dialog for inviting users to cowatch in Copresent Home.
Signature
static Request Oculus.Platform.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 Oculus.Platform.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 Oculus.Platform.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 Oculus.Platform.Cowatching.ResignFromPresenting()
Returns
Request
SetApiNotReadyNotificationCallback ( callback )
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 Oculus.Platform.Cowatching.SetApiNotReadyNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetApiReadyNotificationCallback ( callback )
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 Oculus.Platform.Cowatching.SetApiReadyNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetInitializedNotificationCallback ( callback )
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 Oculus.Platform.Cowatching.SetInitializedNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetInSessionChangedNotificationCallback ( callback )
Sets a callback function that will be triggered when the current user joins/leaves the cowatching session.
Signature
static void Oculus.Platform.Cowatching.SetInSessionChangedNotificationCallback(Message< Models.CowatchingState >.Callback callback)
Parameters
Returns
void
SetPresenterData ( video_title , presenter_data )
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 Oculus.Platform.Cowatching.SetPresenterData(string video_title, string presenter_data)
Parameters
video_title: string  A string representing the title of the video being played in the cowatching session. This parameter must not exceed 100 characters in length.
presenter_data: 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
SetPresenterDataChangedNotificationCallback ( callback )
Sets a callback function that will be triggered when the presenter updates the presenter data.
Signature
static void Oculus.Platform.Cowatching.SetPresenterDataChangedNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetSessionStartedNotificationCallback ( callback )
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 Oculus.Platform.Cowatching.SetSessionStartedNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetSessionStoppedNotificationCallback ( callback )
Sets a callback function that will be triggered when a cowatching session has ended.
Signature
static void Oculus.Platform.Cowatching.SetSessionStoppedNotificationCallback(Message< string >.Callback callback)
Parameters
callback: Message< string >.Callback
Returns
void
SetViewerData ( viewer_data )
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 Oculus.Platform.Cowatching.SetViewerData(string viewer_data)
Parameters
viewer_data: 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
SetViewersDataChangedNotificationCallback ( callback )
Sets a callback function that will be triggered when a user joins or updates their viewer data.
Signature
static void Oculus.Platform.Cowatching.SetViewersDataChangedNotificationCallback(Message< Models.CowatchViewerUpdate >.Callback callback)
Returns
void