Window: vrdisplaypresentchange event

L'événement vrdisplaypresentchange de l'API WebVR est déclenché lorsque l'état de présentation d'un affichage VR change — c'est à dire passe de la présentation à la non présentation, ou vice versa.

Bulles Non
Annulable Non
Interface VRDisplayEvent
Propriété de gestionnaire d'événements onvrdisplaypresentchange

Exemples

Vous pouvez utiliser l'événement vrdisplaypresentchange dans une méthode addEventListener :

js
window.addEventListener("vrdisplaypresentchange", function () {
  if (vrDisplay.isPresenting) {
    info.textContent = "L'affichage a commencé à présenter.";
  } else {
    info.textContent = "L'affichage a cessé de se présenter.";
  }
  reportDisplays();
});

Ou utilisez la propriété de gestionnaire d'événements onvrdisplaypresentchange :

js
window.onvrdisplaypresentchange = function () {
  if (vrDisplay.isPresenting) {
    info.textContent = "L'affichage a commencé à présenter.";
  } else {
    info.textContent = "L'affichage a cessé de se présenter.";
  }
  reportDisplays();
};

Spécifications

No specification found

No specification data found for api.Window.vrdisplaypresentchange_event.
Check for problems with this page or contribute a missing spec_url to mdn/browser-compat-data. Also make sure the specification is included in w3c/browser-specs.

Compatibilité des navigateurs

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
vrdisplaypresentchange event
DeprecatedNon-standard

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
User must explicitly enable this feature.
Has more compatibility info.

Voir aussi