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 (en-US)
Propriété de gestionnaire d'événements onvrdisplaypresentchange (en-US)

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 (en-US) :

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

BCD tables only load in the browser

Voir aussi