Search completed in 1.02 seconds.
13 results for "isSessionSupported":
XRSystem: isSessionSupported() - Web APIs
WebAPIXRSystemisSessionSupported
the xrsystem method issessionsupported() returns a promise which resolves to true if the specified webxr session mode is supported by the user's webxr device.
... syntax var issupportedpromise = xr.issessionsupported(xrsessionmode) parameters xrsessionmode a domstring specifying the webxr session mode for which support is to be checked.
... exceptions rather than throwing true exceptions, issessionsupported() rejects the returned promise, passing to the rejection handler a domexception whose name is one of the following strings.
...And 3 more matches
XRSystem: requestSession() - Web APIs
WebAPIXRSystemrequestSession
xrsession.requestanimationframe(onxranimationframe); }).catch(function(error) { // "immersive-vr" sessions are not supported console.warn("'immersive-vr' isn't supported, or an error occurred activating vr!"); }); verifying webxr support and using a button to start vr mode the following example shows how to use both issessionsupported() and requestsession().
...next, it calls issessionsupported(), passing it the desired session option before enabling controls for entering xr.
...finally, the onbuttonclicked() method calls requestsession() using the same session option passed to issessionsupported().
... if (navigator.xr) { navigator.xr.issessionsupported('immersive-vr') .then((issupported) => { if (issupported) { immersivebutton.addeventlistener('click', onbuttonclicked); immersivebutton.innerhtml = 'enter xr'; immersivebutton.disabled = false; } else { console.log("webxr doesn't support immersive-vr mode!"); } }); } else { console.log("webxr is not available!"); } function onbuttonclicked() { if (!xrsession) { navigator.xr.requestsession('immersive-vr') .then((session) => { xrsession = session; // onsessionstarted() not shown for reasons of brevity and clarity.
XRSystem - Web APIs
WebAPIXRSystem
methods in addition to inheriting methods from its parent interface, eventtarget, the xrsystem interface includes the following methods: issessionsupported() returns a promise which resolves to true if the browser supports the given xrsessionmode.
... examples the following example shows how to use both issessionsupported() and requestsession().
... if (navigator.xr) { immersivebutton.addeventlistener("click", onbuttonclicked); navigator.xr.issessionsupported('immersive-vr') .then((issupported) => { if (issupported) { immersivebutton.disabled = false; } else { immersivebutton.disabled = true; }); } function onbuttonclicked() { if (!xrsession) { navigator.xr.requestsession('immersive-vr') .then(() => { // onsessionstarted() not shown for reasons of brevity and clarity.
...to determine this, we call issessionsupported(), passing it the desired session option before enabling the button, immersivebutton, which the user can then use to switch to immersive mode only if immersive vr mode is available.
Movement, orientation, and motion: A WebXR example - Web APIs
WebAPIWebXR Device APIMovement and motion
function setupxrbutton() { if (navigator.xr.issessionsupported) { navigator.xr.issessionsupported(session_type) .then((supported) => { xrbutton.disabled = !supported; }); } else { navigator.xr.supportssession(session_type) .then(() => { xrbutton.disabled = false; }) .catch(() => { xrbutton.disabled = true; }); } } the label of the button gets adjusted in the code that handles actuallys ttarting and stopp...
...it gets called as the handler for the promise returned by issessionsupported().
Starting up and shutting down a WebXR session - Web APIs
WebAPIWebXR Device APIStartup and shutdown
to find out if a given mode is supported, simply call the xrsystem method issessionsupported().
... const immersiveok = await navigator.xr.issessionsupported("immersive-vr"); if (immersiveok) { // create and use an immersive vr session } else { // create an inline session instead, or tell the user about the // incompatibility if inline is required } creating and starting the session a webxr session is represented by an xrsession object.
Index - Web APIs
WebAPIIndex
5240 xr.issessionsupported() api, ar, augmented reality, experimental, method, reference, vr, virtual reality, webxr, webxr device api, xr, issessionsupported the xr method issessionsupported() returns a promise which resolves to true if the specified webxr session mode is supported by the user's webxr device.
WebXR application life cycle - Web APIs
WebAPIWebXR Device APILifecycle
call navigator.xr.issessionsupported(), specifying the webxr experience mode you want to provide: inline, immersive-vr, or immersive-ar, in order to determine whether or not the type of session you wish to provide is available.
XRSession.cancelAnimationFrame() - Web APIs
WebAPIXRSessioncancelAnimationFrame
const xr = navigator.xr; let requesthandle = null; let xrsession = null; if (xr) { xr.issessionsupported('immersive-vr') .then((issupported) => { if (issupported) { startxr(); } }); } function framecallback(time, xrframe) { xrsession.requestanimationframe(framecallback); // update and render the frame } async function startxr() { xrsession = xr.requestsession("immersive-vr"); if (xrsession) { stopbutton.onclick = stopxr; requesthandle = xrsession.requestanimatio...
XRSession.requestAnimationFrame() - Web APIs
WebAPIXRSessionrequestAnimationFrame
note: a real application should check that the device and the user agent support webxr api at all and then that they both support the desired session type via xr.issessionsupported().
XRSessionMode - Web APIs
WebAPIXRSessionMode
usage notes the xrsessionmode type indicates the values that can be specified when calling xr.issessionsupported() to determine whether or not the specified session type is supported and available to be used, and by requestsession() to attempt to open a new webxr session.
XRSystem: devicechange event - Web APIs
WebAPIXRSystemdevicechange event
if (navigator.xr) { navigator.xr.addeventlistener("devicechange", event => { navigator.xr.issessionsupported("immersive-vr") .then(immersiveok) => { if (immersiveok) { enablexrbutton.disabled = false; } else { enablexrbutton.disabled = true; } }); }); } when devicechange is received, the handler set up in this code calls the xr method issessionsupported() to find out if there's a device available that can handle immersive vr presentations.
Feature-Policy: xr-spatial-tracking - HTTP
WebHTTPHeadersFeature-Policyxr-spatial-tracking
this policy controls whether navigator.xr.requestsession() can return xrsession that requires spatial tracking and whether user agent can indicate support for sessions supporting spatial tracking via navigator.xr.issessionsupported() and devicechange event on navigator.xr object.
HTTP Index - HTTP
WebHTTPIndex
this policy controls whether navigator.xr.requestsession() can return xrsession that requires spatial tracking and whether user agent can indicate support for sessions supporting spatial tracking via navigator.xr.issessionsupported() and devicechange event on navigator.xr object.