Javascript + HTML
Code template
<!DOCTYPE html>
<html>
<head>
<title>Arcware Pixel Streaming WebSDK | HTML + JavaScript</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
#video-container {
width: 100vw;
height: 100vh;
position: relative;
}
.button-interaction {
position: absolute;
width: 200px;
right: 100px;
bottom: 20px;
z-index: 9;
}
</style>
<script type="module">
import { ArcwareInit } from "https://unpkg.com/@arcware-cloud/[email protected]/index.mjs";
let Application;
const { PixelStreaming, Application: ArcwareApplication } = ArcwareInit(
{
shareId: "<your-shareId-goes-here>"
},
{
initialSettings: {
StartVideoMuted: true,
AutoConnect: true,
AutoPlayVideo: true
},
settings: {
infoButton: true,
micButton: true,
audioButton: true,
fullscreenButton: true,
settingsButton: true,
connectionStrengthIcon: true
}
}
);
Application = ArcwareApplication;
Application.getApplicationResponse((response) => {
console.log("ApplicationResponse", response);
});
window.addEventListener("DOMContentLoaded", () => {
const container = document.getElementById("video-container");
container.appendChild(PixelStreaming.rootElement);
});
window.handleSendCommand = function (command) {
if (Application) {
Application.emitUIInteraction(command);
}
};
</script>
</head>
<body>
<div id="video-container"></div>
<button
class="button-interaction"
onclick="handleSendCommand({ test: 'Send command' })"
>
Emit command to Unreal
</button>
</body>
</html>What this example does
Notes
Last updated