immersive-web / webxr

Repository for the WebXR Device API Specification.
https://immersive-web.github.io/webxr/
Other
3k stars 386 forks source link

Display loading content before presentation without subsequent user interaction #315

Closed jsantell closed 6 years ago

jsantell commented 6 years ago

In the CardboardVRDisplay used in the webvr-polyfill, when entering VR, a div is displayed temporarily, prompting the user to put the device into a cardboard headset. Behind the scenes, the document has requested fullscreen (via user activation), and the stereoscopic rendering begins after device rotation to landscape, or a few seconds. Since it's not using a native WebVR API, the stereoscopic can display anytime after the rotate instructions is removed.

Some current users of the polyfill overload this loading screen with their own content, but that wouldn't work on any native platforms. In the latest spec, it's only possible to create a new session via user activation. The user activation details say it can support subsequent commands from user activation ("4 seconds" being ok, where "4 hours" is not, understandably). Would this support the ability to display monoscopic content on the host display while lazily beginning the stereoscopic experience?

window.addEventListener('click', () => {
  displayCustomDiv();
  setTimeout(() => xrDevice.requestSession(), 4000);
});

Or would it be best handled in storing the session during initial user activation, but lazily begin requesting/drawing frames? Seems like this should work on external XRDevices, but less confident on mobile devices like Daydream or GearVR.

let session;
window.addEventListener('click', async function() {
  displayCustomDiv();
  session = await xrDevice.requestSession();
  setTimeout(() => session.requestAnimationFrame(animate), 4000);
});

function animate() {
  // render with XRDevice
  session.requestAnimationFrame(animate);
}

Discussion in CardboardVRDisplay with regard to how to support this interstitial: https://github.com/googlevr/webvr-polyfill/issues/292#issuecomment-355513545

toji commented 6 years ago

To be clear, there's two issues at play here: One is that regardless of whether or not the developers wants to show a custom splash or the system displays a splash itself, there's the potential for a significant delay between the original user activation event and the point that the VR content actually begins displaying, which would traditionally make it impossible to, say, wait until the user is full in VR to begin playing media. I thought we had something to account for this in the explainer but that appears to not be the case. I'll file a separate issue for it.

The second issue, of developers wanting to show custom 2D UI prior to entering VR, is one that I'm not sure how I feel about and would like to understand the context more. What type of content do we anticipate developers wanting to show here? If it's simply instructions on how to prepare the system for VR viewing (like placing a phone in a harness) I feel strongly that should be left to the user agent. Especially because in some cases it's not skippable (like with Daydream) or nonsensical (I'm already browsing in VR). In those situations any instructions given by the developer will either be redundant, doubling up on the amount of time users have to wait to get into VR as two unskippable screens show, or unnecessary. (User: "Yes, random VR site. I know you want me to put the phone into the headset. I'm already in VR and I'm on a PC. You can go :rage: off now.") This screen works specifically in the context of the polyfill because we know that it only applies to mobile devices being used with a cardboard-like viewer.

But maybe I'm missing the reason that devs want the interstitial? What are some of the use cases?

jsantell commented 6 years ago

cc @jeppester

toji commented 6 years ago

For the sake of reducing the number of active issues on this repo, closing this due to lack of additional feedback. The media playback problem has it's own issue and the Cardboard splash image isn't something that I believe we should be supporting.