Skip to main content
Justvdl
New Participant
January 3, 2022

Spectator Camera for Casting

Hey All,

 

I've been trying to get the Oculus Spectator mode (https://developer.oculus.com/documentation/unity/unity-spectator-camera/) working, but I can't even get the example scene to work. The switch between first-person view and spectator view does nothing for the 'cast view'. 
I've tried with multiple unity versions, oculus SDK versions, cast devices, and HMD's (Quest 1 and 2).

Development build is off and experimental features are on, am I forgetting something? 

 

Has anyone ever made this work? And if so; how?

Thanks in advance!

11 replies

New Participant
February 24, 2022

Did you manage to solve this issue?

Justvdl
JustvdlAuthor
New Participant
April 4, 2022

Nope, feature seems abandoned and left broken in the SDK

Up and Coming
September 7, 2022

Has anyone figured out the solution to make it work ?

New Participant
November 12, 2022

I've only ever seen it in Noda, no other app I know of. It's demoed briefly here: https://youtu.be/91g3FipCIeQ

Participant
December 9, 2022

I've implemented the Spectator Camera in my game (https://colorball.quest/) and it worked pretty good:

https://www.youtube.com/watch?v=AryFnr9-kQk

But it seems that it stopped working on newer Quest versions ðŸ˜­ 

I'm not able to reactivate it... really seems abandoned ðŸ˜ 

It was such a great feature... 😥

Up and Coming
March 29, 2023

Any news on this?

 

Up and Coming
March 30, 2023

I have the exact same problem here.

Up and Coming
June 26, 2023

 

latest SDK release notes mention some progress on spectator mode but i still can't get it to work. any ideas why?

Inspiring
November 8, 2023

I'm also trying to get it to work. I made a fresh build from the example scene and what I found is that most of the code works except for the actual casting. It adds an external camera, it updates the head sphere transform, it responds to the controller inputs to position the selfie screen.

It also supposedly succeeds in setting the camera to initialized when pressing the trigger, as OVRPlugin.Media.SetPlatformCameraMode(OVRPlugin.Media.PlatformCameraMode.Initialized) returns true. But looking at OVRPlugin.Media.GetPlatformCameraMode() it either doesn't actually succeed or is reset immediately to OVRPlugin.Media.PlatformCameraMode.Disabled.

OVRPlugin.Media.IsMrcEnabled() tells me MRC is enabled, but not activated, as OVRPlugin.Media.IsMrcActivated() is false. I'm also reading OVRPlugin.Media.IsCastingToRemoteClient() but it doesn't change to true when starting a stream to the smartphone app. According to OVRPlugin.Media.GetMrcActivationMode(), which is set to Automatic, it should activate once the stream starts but apparently OVRPlugin.Media is not properly integrated with the stream.

According to the documentation (https://developer.oculus.com/documentation/unity/unity-spectator-camera/), devs are supposed to check for Oculus.Platform.Core.IsInitialized() but the Oculus namespace is deprecated, and doesn't include Oculus.Platform anymore. It also says to "Ensure that you setup the platform with an app ID as it is required for the platform initialization."

My fresh build didn't have an app ID set in the platform settings and I didn't want to make a new project in the Oculus backend so I tried building the same example scene from my existing app with its ID but there I get an "OVRMrcLib not loaded" error and the code breaks entirely, not updating the head position or responding to controller inputs. Then I tried using my app ID in the fresh spectator mode scene build but there it neither breaks anything nor does it enable the last step of activating MRC.

So that's at least two things that are broken. OVRPlugin.Media is maybe shut out of accessing streaming because of security reasons? Or it is waiting for communication from another mixed reality capture app like OBS (since spectator mode is branched off of MRC)? The "OVRMrcLib not loaded" error in my active project is a further headache, no idea what is causing this. 

krzysh
New Participant
August 22, 2024

I managed to get a bit closer, but it still doesn't work. To set it up properly, you need to follow the docs in the MRC setup documentation, in addition to the Spectator Camera one: https://developer.oculus.com/documentation/unity/unity-mrc/

To fix the "OVRMrcLib not loaded" issue, you need to add the following lines to AndroidManifest.xml:

       <uses-native-library
                android:name="libOVRMrcLib.oculus.so"
                android:required="true" />

Then, to fix the issue where SetPlatformCameraMode does nothing without reporting any errors, you need to properly initialize the Platform SDK. Make sure to set a valid app ID in the settings, and insert the following code before SetPlatformInitialized:

if (!Oculus.Platform.Core.IsInitialized())
{
    Oculus.Platform.Core.Initialize();
}

OVRPlugin.Media.SetPlatformInitialized();

With these changes, after pressing the view switch button in the SpectatorCamera sample (which doesn't exist in the latest versions of the SDK btw, I had to get the scene file from an older release, but all other pieces are still there) the stream clearly tries to start as can be seen in logcat, there is even trace of some JSON being sent to the streaming client, but encoder initialization fails because "the surface is already conected". When rendering using GLES, nothing happens and the stream just doesn't start, but when using Vulkan, the entire app crashes after that.