Integrate HISPlayer SDK with the Meta XR All-in-One SDK.
First, please configure the Unity project for Oculus by following this Tutorial and open Window > Package Manager > Packages: In Project to check Meta XR All-in-One SDK is installed properly.
- Minimal Meta XR All-in-One version: 60.0
- Minimal Unity version: 2021.3.26f1
- Minimal HISPlayer SDK version: 3.3.0
- Minor version - Android 10.0 ‘Quince Tart’
- Minimum SDK: 29
- Linear
- IL2CPP - ARM64
Open Edit > Player Settings > MetaXR, select the Android platform and clik "Select All" and "Apply All" in order to set up all the Oculus settings.
Select XR Plug-in Management, please make sure that you have the Oculus option checked. Otherwise, when you run the application, it will show a 2D window without XR environment.
- Edit > Project Settings > XR Plug-in Management
If you have not imported HISPlayer SDK yet, please follow the Quickstart Guide.
Please, download the sample here: HISPlayer MetaXR 360 Sample (no need to download it if you have received it in the email). The sample is intended for playing 360 video.
Before using the sample, please make sure you have followed the above requirements to set-up your Unity project for Oculus and HISPlayer SDK. To use the sample, please follow these steps :
- Set up the Meta XR All-in-One environment
- Import HISPlayer SDK
- Import HISPlayer Meta XR Sample
- Open Assets/HISPlayerOculusSample/Scenes/HISPlayerOculusSample
- Input the license key through the Inspector Unity window: StreamController GameObject > HISPlayerSample component > License Key
- Open File > Build Settings > Add Open Scenes
- Build and Run
To check how to set up the SDK and API usage, please refer to Assets/HISPlayerOculusSample/Scripts/Sample/HISPlayerSample.cs and StreamController GameObject in the Editor.
To check more about the project explanation, please refer to Assets/HISPlayerOculusSample/README.pdf
Unity provides ways to configure how you will display your video content on the 360 environment. Please, refer to the following Unity documentation to check what kind of settings you will need: Unity Video Panoramic Tutorial.
We provide a material to configure the options of your video so please, refer to Assets/HISPlayerOculusSample/Resources/RenderTextures/Materials/HISPlayer_360_Material.material to check the 360 settings.
In our sample we're using the following options:
- Mapping: Latitude Longitude Layout
- Image Type: 360 Degrees
- 3D Layout: None
For 180 degrees playback usage, please change the Image Type of the material (HISPlayer_360_Material.mat) to 180 Degrees.
If you are using HISPlayer SDK version 3.4.0 and above, you will find HISPlayer360Shader.shader for 360 video playback in Packages/com.hisplayer.hisplayersdk/HISPlayer/Scripts/Shaders/.
HISPlayerOculusSample uses the default Unity Skybox/Panoramic shader, as explained in the HISPlayer 360 Material.
If you use Linear Color Space in the Unity Project Settings > Player Settings > Other Settings > Rendering > Color Space, please change the default shader to HISPlayer360Shader which will improve the video rendering quality by following these steps :
- Open Assets/HISPlayerOculusSample/Resources/RenderTextures/Materials/HISPlayer_360_Material.mat
- In the Inspector window, change Shader to HISPlayer360Shader
- Make sure you have the following setting of the material:
If you face an issue where the video is vertically inverted or rendered upside down, please follow 1 of these 2 approaches:
- Approach 1 (Recommended): Use HISPlayer360Shader.shader and attach it to the material as explained in the previous section. Make sure that the Flip Vertically option is enabled.
- Approach 2: Set FlipTextureVertically of the StreamProperties to true before calling SetUpPlayer() in your project script. This API will flip the texture vertically. This API will work only for Android and Meta Quest devices, it will not have effect in the Unity editor. For example:
// Flip texture vertically to render the texture correctly for Skybox material. multiStreamProperties[0].FlipTextureVertically = true; SetUpPlayer();
Please don't mix both approaches, otherwise the video will be veritcally inverted.