Share Content from Oculus Apps

The Oculus platform provides the Sharing feature, which enables users to share their VR experience with photos, videos, and livestreaming to their Facebook network. In addition, users can cast content from their Oculus device to another device on the same network.

Note: The Sharing feature is only available for Android apps at this time.

Account Linking with Facebook

Users who wish to share with their Facebook network first need to link their Oculus account to their Facebook account. If you want users to share content from your apps, notify them that Sharing is available to them if they link their accounts using the Settings -> Linked Account -> Link to Facebook section of the Oculus 2D app.

Sharing is on By Default

It is important to note that the Sharing feature is enabled for your apps by default. To disable Casting, Livestreaming or Video Recording for your apps, navigate to Sharing in the Developer Center, select an app, move the slider to disable, and then choose Save.

Livestreaming APIs

All sharing is initiated by the user through the Oculus Platform. However, there are a couple of SDK methods you should call at certain points in your game to accommodate livestreaming. For example, you should pause a livestream if the user is entering a password or credit card information. Then, once the user has finished that activity, you can resume the stream.

The following SDK methods can be called from the client app.

  • Check the livestream status:

Native - ovr_Livestreaming_GetStatus()

Unity - Platform.Livestreaming.GetStatus()

Check the status of the livestream.

  • Pause the livestream:

Native - ovr_Livestreaming_PauseStream()

Unity - Platform.Livestreaming.PauseStream()

Pause the livestream.

  • Resume the livestream:

Native - ovr_Livestreaming_ResumeStream()

Unity - Platform.Livestreaming.ResumeStream()

Resume the paused livestream.

If you’re using Unreal, please use the native C API using the information found in Unreal Development Getting Started.

Testing Livestreaming

Livestreaming a user’s experience may have an impact on the performance of your app. We recommend testing how your app performs when a user is livestreaming and adjusting features and performance as appropriate.

To test livestreaming in your app:

  1. Add the ovr_Livestreaming_GetStatus() check to your app to determine when a user has enabled livestreaming.
  2. Upload a build to a testing channel in the Developer Center. Information about release channels and uploading builds can be found in the Distribute section of these docs. Any user who has been added to your app’s organization will be able to test livestreaming.
  3. Launch the app and initiate a livestream. Monitor the performance of your app while the livestream is running to determine if any adjustments are necessary. Please see the Mobile Rendering Guidelines page for best practices and performance requirements for mobile apps.
  4. If adjustments are required during a livestream, enable them any time a user has initiated a livestream by checking ovr_Livestreaming_GetStatus().

Photo Sharing APIs

Photo Sharing allows users to post screen captures they take in VR to their Facebook network. If a user has not previously associated their Facebook and Oculus accounts, they will be prompted to do so the first time they are shown the sharing modal.

The following SDK method allows users to share photos from inside your app.

  • Native - ovr_Media_ShareToFacebook
  • Unity - Platform.Media.ShareToFacebook

When calling ovr_Media_ShareToFacebook, you’ll provide a path to an image that will be shared with Oculus Home. You’ll also be able to pass a text suggestion that will be populated in the post body of the modal presented to the user. They may edit the text before they post to their Facebook feed.

Photo Sharing supports PNG, GIF, and JPEG image formats.

If you’re using Unreal, please use the native C API using the information found in Unreal Development Getting Started.

Recording and Accessing Photos

Photos that users want to share should be saved internally in your app. When a user initiates the request to share the photo, you’ll provide access to Oculus by sending a path to a file saved in the internal storage directory for your application.

  • Native Android - If you save the photo to external (to the app) storage, you’ll need to provide share permissions to the file. Android provides documentation about sharing files.
  • Unity Apps - If you save the photo to external (to the app) storage, you’ll need to provide share permissions to the file. This can be done by explicitly providing access or by saving to system folders that the Oculus app has access to.

If you use external storage and the Oculus app does not have permission to access the file, the request will fail.

Launch the Sharing Modal Dialog

Use the following method to launch the photo sharing modal.

OVRP_PUBLIC_FUNCTION(ovrRequest)ovr_Media_ShareToFacebook(const char *postTextSuggestion, const char *filePath, ovrMediaContentType contentType);

In this example:

  • postTextSuggestion is a default, pre-populated text for the post body
  • filePath is the path to a file in your app’s internal storage directory that should be shared with Oculus Home.
  • ovrMediaContentType is the media type of the file identified by the filePath. At this time only ovrMediaContentType_Photo is supported.

After calling ovr_Media_ShareToFacebook, the user will be shown an Oculus modal displaying their chosen photo. Here, the user can add their own message for the body of the post and select their desired privacy settings.

The user can then select Share to Facebook to complete the action, close the modal, and return to your app. A status of SHARED will be returned indicating if the user successfully shared the photo, or CANCELLED if the user canceled the action. An error will be returned if something went wrong.