IanPhilips / UnityOculusAndroidVRBrowser

3D browser based on GeckoView and Oculus SDK for Unity projects built on Android (Oculus Go/Quest, maybe GearVR)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can we make RestartSession work?

thezenmaster opened this issue · comments

Hi,

Great job on the project! I'm using it to play videos in VR and it works very well. One issue that I'm running into is restarting the View after hiding/showing the browser window. I tried uncommenting the RestartSession method, but, as the TODO comment states, the texture is not being updated after restart. Do you know what could be causing that or any ways to get around it?

Thanks!

Why do you want to restart the view?

I have a Unity Plane using your plugin for GeckoView. I want to be able to create/destroy that Unity Plane object, or at least hide and show the plane. Any sort of Start/Stop functionality works for me.

Thanks!

Why don't you just set scale to 0 to hide the plane?

As far as I understand, this approach has some undesired side effects. What if we switch Unity scenes, and then the Plane object is destroyed? What if there is audio playing from the webview window and we "hide" it? GeckoView itself supports Play/Pause functionality since this is a standard behavior of Android views.

I haven't dug deep enough into this yet, but it seams the issue stems from restart implementation of OVROverlay. What do you think? I'm happy to try and debug this some more.

Check out DeactivateGeckoSession() and its reciprocal in BrowserView.cs and keep the browser gameobject alive through scenes

Thanks Ian! DeactivateGeckoSession works. Actually, OVROverlay has a 'hidden' property which we use instead of setting the scale to 0.