UNPKG

@snap/camera-kit

Version:
161 lines (157 loc) 55 kB
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>CameraKitSession | CameraKit Web SDK - v1.13.0</title><meta name="description" content="Documentation for CameraKit Web SDK"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><script async src="../assets/hierarchy.js" id="tsd-hierarchy-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">CameraKit Web SDK - v1.13.0</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">CameraKit Web SDK</a></li><li><a href="CameraKitSession.html">CameraKitSession</a></li></ul><h1>Class CameraKitSession</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>A CameraKitSession represents a single rendering pipeline connecting an input media source to output <code>&lt;canvas&gt;</code> elements. When a Lens is applied to the session, CameraKit uses the Lens to transform the input media into rendered output.</p> <p>CameraKitSession is the primary object that applications interact with when integrating the CameraKit SDK.</p> <p>A CameraKitSession instance is obtained by calling <a href="CameraKit.html#createsession" class="tsd-kind-method">CameraKit.createSession</a>.</p> </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-6">cameraKit</span><span class="hl-1"> = </span><span class="hl-2">await</span><span class="hl-1"> </span><span class="hl-5">bootstrapCameraKit</span><span class="hl-1">(</span><span class="hl-0">config</span><span class="hl-1">)</span><br/><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-6">session</span><span class="hl-1"> = </span><span class="hl-2">await</span><span class="hl-1"> </span><span class="hl-0">cameraKit</span><span class="hl-1">.</span><span class="hl-5">createSession</span><span class="hl-1">()</span> </code><button type="button">Copy</button></pre> </div></div></section><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Properties</h3><div class="tsd-index-list"><a href="CameraKitSession.html#output" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>output</span></a> <a href="CameraKitSession.html#playing" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>playing</span></a> <a href="CameraKitSession.html#events" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>events</span></a> <a href="CameraKitSession.html#metrics" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>metrics</span></a> <a href="CameraKitSession.html#keyboard" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-1024"></use></svg><span>keyboard</span></a> </div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="CameraKitSession.html#applylens" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>apply<wbr/>Lens</span></a> <a href="CameraKitSession.html#removelens" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>remove<wbr/>Lens</span></a> <a href="CameraKitSession.html#play" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>play</span></a> <a href="CameraKitSession.html#pause" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>pause</span></a> <a href="CameraKitSession.html#mute" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>mute</span></a> <a href="CameraKitSession.html#unmute" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>unmute</span></a> <a href="CameraKitSession.html#setsource" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Source</span></a> <a href="CameraKitSession.html#setfpslimit" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>setFPSLimit</span></a> <a href="CameraKitSession.html#setscreenregions" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>set<wbr/>Screen<wbr/>Regions</span></a> <a href="CameraKitSession.html#destroy" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-2048"></use></svg><span>destroy</span></a> </div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Properties"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Properties</h2></summary><section><section class="tsd-panel tsd-member"><a id="output" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>output</span><a href="#output" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">output</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">live</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement" class="tsd-signature-type external" target="_blank">HTMLCanvasElement</a><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">capture</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/API/HTMLCanvasElement" class="tsd-signature-type external" target="_blank">HTMLCanvasElement</a> <span class="tsd-signature-symbol">}</span></div><div class="tsd-comment tsd-typography"><p>CameraKitSession renders video output to a <code>&lt;canvas&gt;</code> element. In fact, each session contains two canvas outputs corresponding to the RenderTargets used by Lens creators, when using LensStudio to create a Lens.</p> <p>The <code>live</code> output renders content suitable for the Lens user (e.g. it may contain additional UI elements applicable only to the person applying the lens). The <code>capture</code> output renders content suitable for sharing with other users (e.g. sent to the other members of a video call, or saved to disk for sharing later).</p> <p>For many lenses, these outputs are identical – but each lens is free to render differently, based on its own use-case.</p> </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="playing" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>playing</span><a href="#playing" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">playing</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">live</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">capture</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span> <span class="tsd-signature-symbol">}</span></div><div class="tsd-comment tsd-typography"><p>Indicates whether or not the session is currently rendering. If <code>false</code>, rendering is stopped. Otherwise the value indicates which output is being rendered.</p> </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="events" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>events</span><a href="#events" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">events</span><span class="tsd-signature-symbol">:</span> <a href="TypedEventTarget.html" class="tsd-signature-type tsd-kind-class">TypedEventTarget</a><span class="tsd-signature-symbol">&lt;</span><a href="../types/CameraKitSessionEvents.html" class="tsd-signature-type tsd-kind-type-alias">CameraKitSessionEvents</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol"> = ...</span></div><div class="tsd-comment tsd-typography"><p>Add event listeners here to handle events which occur during the CameraKitSession.</p> <p><strong>Note:</strong> Applications may want to handle the <code>error</code> event, and check the contained error type -- if the type is <a href="../types/LensExecutionError.html" class="tsd-kind-type-alias">LensExecutionError</a>, this means the current lens was unable to render and CameraKit will automatically remove the lens.</p> </div><div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-1" class="tsd-anchor"></a>Example<a href="#example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-0">cameraKitSession</span><span class="hl-1">.</span><span class="hl-0">events</span><span class="hl-1">.</span><span class="hl-5">addEventListener</span><span class="hl-1">(</span><span class="hl-3">&#39;error&#39;</span><span class="hl-1">, ({ </span><span class="hl-0">detail</span><span class="hl-1"> }) </span><span class="hl-4">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-2">if</span><span class="hl-1"> (</span><span class="hl-0">detail</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">.</span><span class="hl-0">name</span><span class="hl-1"> === </span><span class="hl-3">&#39;LensExecutionError&#39;</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-0">console</span><span class="hl-1">.</span><span class="hl-5">log</span><span class="hl-1">(</span><span class="hl-3">`Lens </span><span class="hl-4">${</span><span class="hl-0">detail</span><span class="hl-9">.</span><span class="hl-0">lens</span><span class="hl-9">.</span><span class="hl-0">name</span><span class="hl-4">}</span><span class="hl-3"> encountered an error and was removed. Please pick a different lens.`</span><span class="hl-1">)</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">})</span> </code><button type="button">Copy</button></pre> </div></div></section><section class="tsd-panel tsd-member"><a id="metrics" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>metrics</span><a href="#metrics" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">metrics</span><span class="tsd-signature-symbol">:</span> <a href="LensPerformanceMetrics.html" class="tsd-signature-type tsd-kind-class">LensPerformanceMetrics</a></div><div class="tsd-comment tsd-typography"><p>Use this to measure current lens performance.</p> </div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="keyboard" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><code class="tsd-tag">Readonly</code><span>keyboard</span><a href="#keyboard" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">keyboard</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/Keyboard.html" class="tsd-signature-type tsd-kind-interface">Keyboard</a></div><div class="tsd-comment tsd-typography"><p>The <a href="../interfaces/Keyboard.html" class="tsd-kind-interface">Keyboard</a> API enables applications to handle keyboard input requests from lenses. When a lens requests a keyboard, the app displays it in its preferred UI. As users type, the app sends the text back to the lens for display. The lens can also request keyboard dismissal, prompting the app to remove the displayed keyboard.</p> </div><div class="tsd-comment tsd-typography"></div></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="applylens" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>apply<wbr/>Lens</span><a href="#applylens" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="applylens-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">applyLens</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">lens</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/Lens.html" class="tsd-signature-type tsd-kind-interface">Lens</a><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">launchData</span><span class="tsd-signature-symbol">?:</span> <a href="../interfaces/LensLaunchData.html" class="tsd-signature-type tsd-kind-interface">LensLaunchData</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span><a href="#applylens-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Apply a Lens to this session.</p> <p>This method will download (and cache) the Lens executable, and then use that Lens for rendering. If the session is currently playing, this will immediately update the rendered output. Otherwise, the new Lens will be used when session playback in resumed.</p> <p>Calling <code>applyLens</code> replaces any prior Lens – only one Lens is allowed at a time (per session).</p> <p><strong>NOTE</strong>: Errors may occur after the Lens is applied. If the Lens encounters errors while rendering, Camera Kit will automatically remove the Lens from the session and emit a <a href="../types/LensExecutionError.html" class="tsd-kind-type-alias">LensExecutionError</a> event. Applications may want to listen for this error and, for example, prevent the Lens from being selected again by the user.</p> <pre><code class="ts"><span class="hl-0">session</span><span class="hl-1">.</span><span class="hl-0">events</span><span class="hl-1">.</span><span class="hl-5">addEventListener</span><span class="hl-1">(</span><span class="hl-3">&quot;error&quot;</span><span class="hl-1">, ({ </span><span class="hl-0">detail</span><span class="hl-1"> }) </span><span class="hl-4">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-2">if</span><span class="hl-1"> (</span><span class="hl-0">detail</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">.</span><span class="hl-0">name</span><span class="hl-1"> === </span><span class="hl-3">&quot;LensExecutionError&quot;</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-5">preventFutureLensSelection</span><span class="hl-1">(</span><span class="hl-0">detail</span><span class="hl-1">.</span><span class="hl-0">lens</span><span class="hl-1">);</span><br/><span class="hl-1"> </span><span class="hl-5">showMessage</span><span class="hl-1">(</span><span class="hl-3">&quot;We&#39;re sorry, but the Lens you selected encountered an error. Please choose a different Lens.&quot;</span><span class="hl-1">);</span><br/><span class="hl-1"> }</span><br/><span class="hl-1">});</span> </code><button type="button">Copy</button></pre> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">lens</span>: <a href="../interfaces/Lens.html" class="tsd-signature-type tsd-kind-interface">Lens</a></span><div class="tsd-comment tsd-typography"><p>The Lens to apply to this session.</p> </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">launchData</span>: <a href="../interfaces/LensLaunchData.html" class="tsd-signature-type tsd-kind-interface">LensLaunchData</a></span><div class="tsd-comment tsd-typography"><p>This can optionally be provided to pass some initial data to the Lens – only certain Lenses expect launch data.</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4><p>A promise which can have the following results:</p> <ol> <li>Resolved with <code>true</code>: the Lens has been applied.</li> <li>Resolved with <code>false</code>: the Lens has not been applied, but no error occurred – this can happen if a subsequent call to <code>applyLens</code> interrupted the Lens application.</li> <li>Rejected: the Lens has not been applied because an error occurred. This can happen if:</li> </ol> <ul> <li>The Lens ID cannot be found in the LensRepository (use LensRepository to load the Lens before calling this method)</li> <li>Lens content download fails, or the download of any required lens assets fails.</li> <li>An internal failure occurs in the Lens rendering engine when attempting to apply the Lens.</li> </ul> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="removelens" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>remove<wbr/>Lens</span><a href="#removelens" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="removelens-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">removeLens</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span><a href="#removelens-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Remove a Lens from this session.</p> <p>When a Lens is removed, rendering continues if the session is playing. It will just render the session input directly to the outputs without any image processing.</p> </div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">&gt;</span></h4><p>A promise which can have the following results:</p> <ol> <li>Resolved with <code>true</code>: the session's rendered output has no lens applied.</li> <li>Resolved with <code>false</code>: the current lens has been removed, but a subsequent call to <code>applyLens</code> means that the session's rendered output will still have a (new) lens applied.</li> <li>Rejected: the lens has failed to be removed. This can happen if an internal failure occurs in the Lens rendering engine when attempting to remove the lens.</li> </ol> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="play" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>play</span><a href="#play" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="play-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">play</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">target</span><span class="tsd-signature-symbol">?:</span> <a href="../types/RenderTarget.html" class="tsd-signature-type tsd-kind-type-alias">RenderTarget</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#play-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Start/resume session playback – LensCore will begin rendering frames to the output.</p> <p>If no source has been set for the session, calling <code>play()</code> will update the playing state, but no actual image processing will occur until <code>setSource()</code> is called.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">target</span>: <a href="../types/RenderTarget.html" class="tsd-signature-type tsd-kind-type-alias">RenderTarget</a><span class="tsd-signature-symbol"> = &quot;live&quot;</span></span><div class="tsd-comment tsd-typography"><p>Specify the <a href="../types/RenderTarget.html" class="tsd-kind-type-alias">RenderTarget</a> to render. Defaults to the <code>live</code> RenderTarget.</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise resolves when playback state has been updated. If no source has been set, this means <code>play</code> will resolve before any frames are processed -- but once a source is set, frames will immediately begin processing.</p> <div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-2" class="tsd-anchor"></a>Example<a href="#example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="ts"><span class="hl-4">const</span><span class="hl-1"> </span><span class="hl-6">cameraKitSession</span><span class="hl-1"> = </span><span class="hl-2">await</span><span class="hl-1"> </span><span class="hl-0">cameraKit</span><span class="hl-1">.</span><span class="hl-5">createSession</span><span class="hl-1">()</span><br/><span class="hl-2">await</span><span class="hl-1"> </span><span class="hl-0">cameraKitSession</span><span class="hl-1">.</span><span class="hl-5">setSource</span><span class="hl-1">(</span><span class="hl-0">mySource</span><span class="hl-1">)</span><br/><span class="hl-2">await</span><span class="hl-1"> </span><span class="hl-0">cameraKitSession</span><span class="hl-1">.</span><span class="hl-5">play</span><span class="hl-1">()</span><br/><br/><span class="hl-7">// If you call `play` before `setSource`, the call to `play` will resolve but playback will only begin once a</span><br/><span class="hl-7">// media source has been set.</span> </code><button type="button">Copy</button></pre> </div></div></li></ul></section><section class="tsd-panel tsd-member"><a id="pause" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>pause</span><a href="#pause" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="pause-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">pause</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">target</span><span class="tsd-signature-symbol">?:</span> <a href="../types/RenderTarget.html" class="tsd-signature-type tsd-kind-type-alias">RenderTarget</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#pause-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Pause session playback – LensCore will stop rendering frames to the output.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">target</span>: <a href="../types/RenderTarget.html" class="tsd-signature-type tsd-kind-type-alias">RenderTarget</a><span class="tsd-signature-symbol"> = &quot;live&quot;</span></span><div class="tsd-comment tsd-typography"><p>Specify the RenderTarget to pause playback. May be either <code>'live'</code> or <code>'capture'</code>. Default is <code>'live'</code>.</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise resolves when playback has stopped.</p> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="mute" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>mute</span><a href="#mute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="mute-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">mute</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fade</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#mute-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Mute all sounds (default SDK state is unmuted).</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fade</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>Do we want audio to fade out?</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="unmute" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>unmute</span><a href="#unmute" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="unmute-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">unmute</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fade</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">void</span><a href="#unmute-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Unmute all sounds.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fade</span>: <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol"> = false</span></span><div class="tsd-comment tsd-typography"><p>Do we want audio to fade in?</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="setsource" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Source</span><a href="#setsource" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setsource-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setSource</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">source</span><span class="tsd-signature-symbol">:</span> <a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a><span class="tsd-signature-symbol">&gt;</span><a href="#setsource-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Set the media source for this session.</p> <p>Sessions may only have one source at a time - if <code>setSource</code> is called multiple times, subsequent calls replace the prior source. Setting the source does not trigger rendering (that’s done by <code>session.play()</code>). If the session is already playing, setting the source will immediately begin rendering the new source.</p> <p>The CameraKit SDK provides implementations for various common sources, which applications can create using the following functions:</p> <ul> <li><a href="../functions/createMediaStreamSource.html" class="tsd-kind-function">createMediaStreamSource</a></li> <li><a href="../functions/createVideoSource.html" class="tsd-kind-function">createVideoSource</a></li> <li><a href="../functions/createImageSource.html" class="tsd-kind-function">createImageSource</a></li> </ul> <p><strong>Important:</strong> Once a source has been set for a session, it cannot be set again, even if it has been replaced by another one. You must provide a new instance of <a href="CameraKitSource.html" class="tsd-kind-class">CameraKitSource</a> to <a href="CameraKitSession.html#setsource" class="tsd-kind-method">CameraKitSession.setSource</a>. If you want to reuse the existing source, you can use its <a href="CameraKitSource.html#copy" class="tsd-kind-method">CameraKitSource.copy</a> method to create a new instance.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a></span><div class="tsd-comment tsd-typography"><p>A CameraKitSource object representing input media (e.g. a webcam stream, video, or some other source of image data), which CameraKit will supply to Lenses in order for them to render effects on top of that source.</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise is resolved when the source has successfully been set. If the session was already in the playing state, the Promise resolves when the first frame from the new source has been rendered. The resolved value is the <a href="CameraKitSource.html" class="tsd-kind-class">CameraKitSource</a> object attached to the session.</p> <div class="tsd-comment tsd-typography"></div></li><li class="tsd-signature tsd-anchor-link"><a id="setsource-2" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setSource</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">source</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/API/HTMLVideoElement" class="tsd-signature-type external" target="_blank">HTMLVideoElement</a> <span class="tsd-signature-symbol">|</span> <a href="https://developer.mozilla.org/docs/Web/API/MediaStream" class="tsd-signature-type external" target="_blank">MediaStream</a><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?:</span> <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype" class="tsd-signature-type external" target="_blank">Partial</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/CameraKitDeviceOptions.html" class="tsd-signature-type tsd-kind-interface">CameraKitDeviceOptions</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a><span class="tsd-signature-symbol">&gt;</span><a href="#setsource-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Set the media source for this session.</p> <p>Sessions may only have one source at a time - if <code>setSource</code> is called multiple times, subsequent calls replace the prior source. Setting the source does not trigger rendering (that’s done by <code>session.play()</code>). If the session is already playing, setting the source will immediately begin rendering the new source.</p> <p>The CameraKit SDK provides implementations for various common sources, which applications can create using the following functions:</p> <ul> <li><a href="../functions/createMediaStreamSource.html" class="tsd-kind-function">createMediaStreamSource</a></li> <li><a href="../functions/createVideoSource.html" class="tsd-kind-function">createVideoSource</a></li> <li><a href="../functions/createImageSource.html" class="tsd-kind-function">createImageSource</a></li> </ul> <p><strong>Important:</strong> Once a source has been set for a session, it cannot be set again, even if it has been replaced by another one. You must provide a new instance of <a href="CameraKitSource.html" class="tsd-kind-class">CameraKitSource</a> to <a href="CameraKitSession.html#setsource" class="tsd-kind-method">CameraKitSession.setSource</a>. If you want to reuse the existing source, you can use its <a href="CameraKitSource.html#copy" class="tsd-kind-method">CameraKitSource.copy</a> method to create a new instance.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">source</span>: <a href="https://developer.mozilla.org/docs/Web/API/HTMLVideoElement" class="tsd-signature-type external" target="_blank">HTMLVideoElement</a> <span class="tsd-signature-symbol">|</span> <a href="https://developer.mozilla.org/docs/Web/API/MediaStream" class="tsd-signature-type external" target="_blank">MediaStream</a></span><div class="tsd-comment tsd-typography"><p>A CameraKitSource object representing input media (e.g. a webcam stream, video, or some other source of image data), which CameraKit will supply to Lenses in order for them to render effects on top of that source.</p> </div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">options</span>: <a href="https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype" class="tsd-signature-type external" target="_blank">Partial</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/CameraKitDeviceOptions.html" class="tsd-signature-type tsd-kind-interface">CameraKitDeviceOptions</a><span class="tsd-signature-symbol">&gt;</span></span></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="CameraKitSource.html" class="tsd-signature-type tsd-kind-class">CameraKitSource</a><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise is resolved when the source has successfully been set. If the session was already in the playing state, the Promise resolves when the first frame from the new source has been rendered. The resolved value is the <a href="CameraKitSource.html" class="tsd-kind-class">CameraKitSource</a> object attached to the session.</p> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="setfpslimit" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>setFPSLimit</span><a href="#setfpslimit" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setfpslimit-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setFPSLimit</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">fpsLimit</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#setfpslimit-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Set an FPS limit.</p> <p>This may be useful to reduce CPU/GPU resource usage by CameraKit if, for example, the input media source has a low FPS – CameraKit would then not try to render more frequently than the source produces new frames.</p> <p>This may also be useful to gracefully degrade performance in situations where lowering FPS is preferable over alternatives.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">fpsLimit</span>: <span class="tsd-signature-type">number</span></span><div class="tsd-comment tsd-typography"><p>A maximum FPS, rendering will not exceed this limit</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise is resolved when the limit is successfully set.</p> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="setscreenregions" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>set<wbr/>Screen<wbr/>Regions</span><a href="#setscreenregions" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="setscreenregions-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">setScreenRegions</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">regions</span><span class="tsd-signature-symbol">:</span> <a href="../types/ScreenRegions.html" class="tsd-signature-type tsd-kind-type-alias">ScreenRegions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#setscreenregions-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Set screen regions for the current Lens.</p> <p>Screen regions define areas of the screen that have special meaning for Lens rendering, such as safe rendering areas, UI button locations, keyboard areas, etc. This allows lenses to adapt their content placement based on the host application's UI layout.</p> <p>Only the regions specified will be active - any previously set regions not included will be automatically removed.</p> </div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">regions</span>: <a href="../types/ScreenRegions.html" class="tsd-signature-type tsd-kind-type-alias">ScreenRegions</a></span><div class="tsd-comment tsd-typography"><p>Configuration object containing the current set of screen regions</p> </div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><p>Promise that resolves when the screen regions have been successfully set</p> <div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="destroy" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>destroy</span><a href="#destroy" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link"><a id="destroy-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">destroy</span><span class="tsd-signature-symbol">()</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span><a href="#destroy-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Destroy the session.</p> <p>The session will become inoperable. Frame processing stops, and any session-scoped graphical resources are freed.</p> </div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">void</span><span class="tsd-signature-symbol">&gt;</span></h4><div class="tsd-comment tsd-typography"></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><sp