Stereo180Video Sample Scene

Important

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible. For additional information and context, please see Submitting Your App to the Oculus Quest Store.


We're no longer accepting submission of 32-bit Oculus Quest apps. Any new or updated Oculus Quest application needs to be 64-bit. Please contact Oculus if you are unable to comply with this policy. Oculus Go and Gear VR apps will not be affected by this change.

The Unity Stereo180Video sample scene demonstrates how to play a stereo 180-degree video. This sample scene is primarily targeted at Mobile developers as the Rift functionality displayed in playing the video is rather simple.

After the sample scene has been set up and started, the user is presented with a brief video. On Rift, this video is playing on Unity’s video player. On Mobile platforms, it is running using ExoPlayer on an Android external surface using an OVROverlay layer, where it can take advantage of Asynchronous TimeWarp (ATW) for better efficiency.

Scene Setup

The Stereo180Video sample scene demonstrates video playback for Oculus Go and Gear VR. This scene requires some special steps before it will work properly.

  1. Copy Assets/Oculus/SampleFramework/Usage/Stereo180Video/StreamingAssets to Assets/StreamingAssets.
  2. Rename Assets/Oculus/SampleFramework/Usage/Stereo180Video/Plugins/Android/java/com/oculus/videoplayer/MyVideoPlayer.java.removeme to MyVideoPlayer.java.
  3. For the audio360 and audio360-exo28 plugins in Assets/Oculus/SampleFramework/Usage/Stereo180Video/Plugins/Android/Audio360/, make sure the Android checkbox is checked.
  4. Open Edit > Project Settings > Player Settings, and in the Publishing Settings section, change the Build System to Gradle. If you don’t already have a custom gradle template, check the Custom Gradle Template check box.
  5. Open Assets/Plugins/mainTemplate.gradle and look at the version number for com.android.tools.build:gradle. If the version number is 2.3.0, use the first list. If it is 3.2.0 or greater, skip to the second list.
    • If the version number is 2.3.0, make the following modifications to mainTemplate.gradle:
      1. In buildscript {repositories { ... } }, add google().
      2. In allprojects {repositories { ... } }, add google() and jcenter().
      3. In dependencies { ... }, add compile 'com.google.android.exoplayer:exoplayer:2.8.4'.
      4. In android { ... }, add sourceSets.main.java.srcDir "$projectDir/../../Assets/Oculus/SampleFramework/Usage/Stereo180Video/Plugins/Android/java". You should now be able to build and run the sample.
    • If the version number is 3.2.0 or greater, make the following modifications to mainTemplate.gradle:
      1. In dependencies { ... }, add implementation 'com.google.android.exoplayer:exoplayer:2.8.4'.
      2. If you are using an earlier version of Unity than 2018.2, also make the following modification to mainTemplate.gradle:
        • In android { ... }, add sourceSets.main.java.srcDir "$projectDir/../../Assets/Oculus/SampleFramework/Usage/Stereo180Video/Plugins/Android/java". You should now be able to build and run the sample.

Scene Walkthrough

This section describes the key prefabs and Game Objects that make the core functionality of this scene work. For this scene, the following are covered:

  • MoviePlayer Game Object – Contains all the components and scripts necessary to play the 180-degree stereoscopic video on Rift or Oculus Go.

MoviePlayer Game Object

This object contains the components and scripts necessary for playing 180-degree stereo videos. Key components are as follows:

  • Mesh Renderer – Draws the video to Unity’s camera. It is only used during Rift playback; on Mobile it is disabled.
  • Movie Player Sample – Script that initializes necessary video components and prepares the video for playback on either Rift or Mobile platforms. On Rift, it uses the Unity video player and for Mobile, the Android ExoPlayer is used. The additional configuration is necessary to add dependencies needed for optimal playback on Mobile platforms.
  • Video Player – Used for Rift video playback.
  • OVR Overlay – Used as a surface on which ExoPlayer plays the video on Mobile platforms.

    Of note is the Android-only Is External Surface check box. When checked, this allows for an Android external surface to be controlled by the Asynchronous TimeWarp (ATW) layer. In this sample, this allows the Android ExoPlayer video player surface to be run as an ATW layer, avoiding redundant texture copies to save memory and cycles.

  • OVR Overlay Mesh Generator – Script that generates meshes for the overlay layer. It can support multiple overlay shapes.