<template>
<div
id="video-container"
ref="videoContainerRef"
style="width: 100vw; height: 100vh"
></div>
<button
@click="handleSendCommand({ test: 'Send command' })"
class="button-interaction"
>
Emit command to Unreal
</button>
</template>
<script lang="ts">
import { ref, onMounted } from "vue";
import * as PixelStreamingWebSdk from "@arcware-cloud/pixelstreaming-websdk";
export default {
setup() {
const videoContainerRef = ref(null);
const arcwareApplication = ref(null);
const handleSendCommand = (descriptor) => {
if (arcwareApplication.value) {
arcwareApplication.value.emitUIInteraction(descriptor);
}
};
const initPixelStreaming = () => {
const { Application } = PixelStreamingWebSdk.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
}
}
);
arcwareApplication.value = Application;
if (videoContainerRef.value) {
videoContainerRef.value.appendChild(Application.rootElement);
}
};
onMounted(initPixelStreaming);
return {
videoContainerRef,
handleSendCommand
};
}
};
</script>
<style scoped>
body {
font-family: system-ui;
background: #000;
text-align: center;
margin: 0;
padding: 0;
}
#app,
#video-container {
width: 100vw;
height: 100vh;
margin: 0;
position: relative;
}
#video-container video {
left: 0;
top: 0;
}
.button-interaction {
position: absolute;
width: 200px;
right: 100px;
bottom: 20px;
margin: auto;
z-index: 9;
}
</style>