In-Game UI
Important notes
Button Element
Function to download the screenshot
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
Last updated