LogoLogo
Quick Links
  • Arcware Cloud
  • Arcware Cloud Platform
    • Getting started with Arcware Cloud
      • Sign up and sign in
      • Select a Plan & Creating your Tenant
      • Creating your Tenant
      • 04. Creating your first project
      • 05. Upload and manage your Unreal packages
      • 06. Setting up your project
      • 07. Preview and share the stream
      • 08. Upgrade your Tenant
      • πŸ‘‘09. Organization
      • πŸ‘‘10. Add-ons
      • 11. Help Center
      • πŸ‘‘12. Customer Support
    • πŸ‘‘Add-ons guide
      • Direct Flow
      • Asset Management
    • Advanced settings
      • 01. AFK Module - User inactivity
      • 02. Max instance run-time
    • Common Arcware Cloud Questions
  • Unreal Engine Setup
    • Set up Pixel Streaming in your own project​
      • 01. Core Settings
        • 01.1. Plugin
        • 01.2. Pixel Streaming Input / Json messages
        • 01.3. Resolution
        • 01.4. Camera Aspect Ratio
        • 01.5. Framerate
        • 01.6. Mouse
        • 01.7. Touch Input Setup for Mobile
        • 01.8. DirectX version
      • 02. Optional Settings
        • 02.1 Touch Controllers
        • 02.2 Playing Media files
    • Using the Arcware Pixel Streaming Template Project
      • Template Overview
      • Getting Started
        • 01. Template download
        • 02. Arcware Blueprints
          • 02.1. Arcware GameMode
          • 02.2. Arcware Player Controller
            • 02.2.1. Sending and Receiving Json messages
            • 02.2.2. Creating and Testing Your Own Events
          • 02.3. Arcware Pawn
            • 02.3.1 Change Movement Mode
            • 02.3.2 Set Collision Channels
            • 02.3.3 Add new camera views
          • 02.4. Arcware HUD
        • 03. Packaging your project
  • ARCWARE FEATURES
    • Screenshot Functionality
      • Frontend Overview
        • Web UI
        • In-Game UI
      • Blueprint overview
  • Web Integration
    • ⬆️PixelStreaming WebSDK
      • Implementing the stream on your app
        • Getting Started
        • Code examples
          • Javascript + HTML
          • React
          • VueJS
          • AngularJS
        • Migration from @arcware/webrtc-plugin
        • Best practices
      • Configuration
      • Interacting with the Stream
        • Stream Container
        • Video Element
        • Customizing the User Interface
        • Handling Dynamic Content
        • Stream Display Customization
      • Interacting with Unreal Engine
      • In depth
        • Ticket destroyed.
        • Events handlers
        • Disconnect
        • ConnectionIdentifier
        • Settings-Menu
        • AFK-module
      • Showcase
    • ⬇️WebRTC Plugin
      • Getting started
      • Props and Types
      • SizeContainer, container and videoRef
      • Enabling the audio
      • Afk-module
      • Interacting with Unreal Engine
      • Example WebRTC Plugin Applications
        • React
        • AngularJS
        • VueJS
        • Plain HTML
Powered by GitBook
LogoLogo

Arcware Cloud Platform

  • Getting started​
  • Add-ons guide
  • Common Arcware Cloud Questions

Unreal Engine Setup

  • Set up Pixel Streaming in your own project​
  • Using the Arcware Pixel Streaming Template Project
  • Common Unreal Engine Questions

Arcware Features

  • Screenshot Functionality

Web Integration

  • PixelStreaming WebSDK
  • WebRTC Plugin

Copyright 2024 - Arcware GmbH

On this page
  • Important notes
  • Button Element
  • Function to download the screenshot
  • Code Example
  1. ARCWARE FEATURES
  2. Screenshot Functionality
  3. Frontend Overview

In-Game UI

Important notes

This example uses HTML and JavaScript, but it can be used as a reference for integrations with any framework.

Button Element

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.

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 CreateScreenshot). This function will handle any browser logic needed to download the file.

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

  • HTML + JavaScript code example:

<!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>
PreviousWeb UINextBlueprint overview

Last updated 7 months ago