> For the complete documentation index, see [llms.txt](https://docs.arcware.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.arcware.cloud/web-integration/screenshot-saving-functionality/frontend-overview/in-game-ui.md).

# In-Game UI

## <mark style="color:yellow;">Important notes</mark>

{% hint style="success" %}
This example uses HTML and JavaScript, but it can be used as a reference for integrations with any framework.
{% endhint %}

### *Button Element*

{% hint style="warning" %}
In this case, the button element can be created within the Unreal Engine application as part of the in-game UI. However, the functionality on the Blueprint side must be the same as with the web implementation, because to download the file, the browser will always need to listen for the response from Unreal Engine and then process the file.
{% endhint %}

### *Function to download the screenshot*

We need a JavaScript function that listens for a response from Unreal Engine (which you can name as you wish; in this example, we used <mark style="color:yellow;">CreateScreenshot</mark>). This function will handle any browser logic needed to download the file.

```javascript
let Application;
let screenshotCounter = 1;
import * as PixelStreamingWebSdk from "https://unpkg.com/@arcware-cloud/pixelstreaming-websdk@latest/index.esm.js";

(function() {
  const { ArcwareInit } = PixelStreamingWebSdk;
  const initResult = new ArcwareInit(
    { shareId: "share-ee32808e-34fe-466a-8dd9-178b71ed5501" },
    {
      initialSettings: { StartVideoMuted: true, AutoConnect: true, AutoPlayVideo: true },
      settings: {
        infoButton: true, micButton: true, audioButton: true, fullscreenButton: true,
        settingsButton: true, connectionStrengthIcon: true,
      }
    }
  );
  
  Application = initResult.Application;
  Application.getApplicationResponse(response => {
    if (response.startsWith("CreateScreenshot")) createFile(window.file);
  });
  
  setTimeout(() => {
    document.getElementById("video-container").appendChild(Application.rootElement);
  });
  window.file = Application.webRtcController.file;
})();

function createFile(file) {
  const blob = new Blob(file.data, { type: file.mimetype });
  const url = URL.createObjectURL(blob);
  const a = document.createElement("a");
  const counterString = String(screenshotCounter).padStart(2, '0');
  a.href = url;
  a.download = `screenshot${counterString}${file.extension}`;
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
  URL.revokeObjectURL(url);
  screenshotCounter++;
}
```

## Code Example

To help guide your implementation, you can refer to the following options:

* CodePen Interactive example

{% embed url="<https://codepen.io/Arcware/pen/rNEjdpV>" %}

* HTML + JavaScript code example:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Pixel Streaming Screenshot</title>
  <style>
    * { margin: 0; padding: 0; }
    #video-container { width: 100vw; height: 100vh; position: relative; }
    #video-container video { left: 0; top: 0; }
  </style>
</head>
<body>
  <div id="video-container"></div>

  <script type="module">
    let Application;
    let screenshotCounter = 1;
    import * as PixelStreamingWebSdk from "https://unpkg.com/@arcware-cloud/pixelstreaming-websdk@latest/index.esm.js";
    
    (function() {
      const { ArcwareInit } = PixelStreamingWebSdk;
      const initResult = new ArcwareInit(
        { shareId: "share-ee32808e-34fe-466a-8dd9-178b71ed5501" },
        {
          initialSettings: { StartVideoMuted: true, AutoConnect: true, AutoPlayVideo: true },
          settings: {
            infoButton: true, micButton: true, audioButton: true, fullscreenButton: true,
            settingsButton: true, connectionStrengthIcon: true,
          }
        }
      );
      
      Application = initResult.Application;
      Application.getApplicationResponse(response => {
        if (response.startsWith("CreateScreenshot")) createFile(window.file);
      });
      
      setTimeout(() => {
        document.getElementById("video-container").appendChild(Application.rootElement);
      });
      window.file = Application.webRtcController.file;
    })();
    
    function createFile(file) {
      const blob = new Blob(file.data, { type: file.mimetype });
      const url = URL.createObjectURL(blob);
      const a = document.createElement("a");
      const counterString = String(screenshotCounter).padStart(2, '0');
      a.href = url;
      a.download = `screenshot${counterString}${file.extension}`;
      document.body.appendChild(a);
      a.click();
      document.body.removeChild(a);
      URL.revokeObjectURL(url);
      screenshotCounter++;
    }
  </script>
</body>
</html>
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.arcware.cloud/web-integration/screenshot-saving-functionality/frontend-overview/in-game-ui.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
