The WebXR Device API's XRSession interface represents an ongoing XR session, providing methods and properties used to interact with and control the session. To open a WebXR session, use the XRSystem interface's requestSession() method.


Required Methods


Removes a callback from the animation frame painting callback from XRSession's set of animation frame rendering callbacks, given the identifying handle returned by a previous call to requestAnimationFrame().


method cancelAnimationFrame(parhandle: dynamic): dynamic


dynamic cancelAnimationFrame(dynamic parhandle)


func cancelAnimationFrame(_ parhandle: dynamic) -> dynamic


dynamic cancelAnimationFrame(dynamic parhandle)


Function cancelAnimationFrame(parhandle As dynamic) As dynamic


  • parhandle:


Ends the WebXR session. Returns a promise which resolves when the session has been shut down.


method end: dynamic


dynamic end()


func end() -> dynamic


dynamic end()


Function end() As dynamic


Schedules the specified method to be called the next time the user agent is working on rendering an animation frame for the WebXR device. Returns an integer value which can be used to identify the request for the purposes of canceling the callback using cancelAnimationFrame(). This method is comparable to the Window.requestAnimationFrame() method.


method requestAnimationFrame(paranimationFrameCallback: dynamic): Int32


Int32 requestAnimationFrame(dynamic paranimationFrameCallback)


func requestAnimationFrame(_ paranimationFrameCallback: dynamic) -> Int32


Int32 requestAnimationFrame(dynamic paranimationFrameCallback)


Function requestAnimationFrame(paranimationFrameCallback As dynamic) As Int32


  • paranimationFrameCallback:


Requests that a new XRReferenceSpace of the specified type be created. Returns a promise which resolves with the XRReferenceSpace or XRBoundedReferenceSpace which was requested, or throws a NotSupportedError if the requested space type isn't supported by the device.


method requestReferenceSpace(partype: dynamic): dynamic


dynamic requestReferenceSpace(dynamic partype)


func requestReferenceSpace(_ partype: dynamic) -> dynamic


dynamic requestReferenceSpace(dynamic partype)


Function requestReferenceSpace(partype As dynamic) As dynamic


  • partype:


Updates the properties of the session's render state to match the values specified in the specified XRRenderStateInit dictionary. Any properties not included in the given dictionary are left unchanged from their current values.


method updateRenderState(parnewState: dynamic): Int32


Int32 updateRenderState(dynamic parnewState)


func updateRenderState(_ parnewState: dynamic) -> Int32


Int32 updateRenderState(dynamic parnewState)


Function updateRenderState(parnewState As dynamic) As Int32


  • parnewState: