Arcware WebRTC Plugin
Javascript/Typescript module to connect any frontend to Unreal Engine 4 app with pixel streaming enabled through signalling WS.
Getting started
import { WebRTCClient } from "@arcware/webrtc-plugin";
<div ref="sizeContainer">
<div ref="videoContainer">
<video ref="videoRef" />
</div>
</div>
const sizeContainerRef = React.useRef();
const containerRef = React.useRef();
const videoRef = React.useRef();
<div ref={sizeContainerRef}>
<div ref={containerRef}>
<video ref={videoElRef} />
</div>
</div>;
<div #sizeContainer>
<div #container>
<video #videoEl></video>
</div>
</div>
@ViewChild("videoEl") inputVideo!: ElementRef;
@ViewChild("container") container!: ElementRef;
@ViewChild("sizeContainer") sizeContainer!: ElementRef;
const args = {
address: "Signalling WS URL",
packageId: "Name of the package (if there are multiple applications)",
settings: {},
sizeContainer: this.$refs.sizeContainer,
container: this.$refs.videoContainer,
videoRef: this.$refs.videoRef,
sizeContainer: sizeContainerRef.current,
container: containerRef.current,
videoRef: videoRef.current,
sizeContainer: this.sizeContainer.nativeElement,
container: this.container.nativeElement,
videoRef: this.inputVideo.nativeElement,
playOverlay: true,
loader: (val) => {},
applicationResponse: (response) => {},
};
const webrtc_client = new WebRTCClient(args);
const emitUIInteraction = webrtc_client.emitUIInteraction;
<head>
<script type="module">
import { WebRTCClient } from "https://unpkg.com/@arcware/webrtc-plugin@latest/index_new.umd.js";
window.addEventListener("load", function () {
const args = {
address: "Signalling WSS URL",
packageId: "id/alias of the package",
settings: {},
sizeContainer: "container",
playOverlay: true,
};
this.webrtc = new WebRTCClient(args);
});
</script>
</head>
<body style="background: black; margin: 50px">
<div id="container"></div>
</body>
const sizeContainerRef = useRef<HTMLDivElement>(null);
const containerRef = useRef<HTMLDivElement>(null);
const videoRef = useRef<HTMLVideoElement>(null);
let webrtc_client: WebRTCClient;
useEffect(() => {
const args: WebRTCClientProps = {
address: "Signalling WSS URL",
packageId: "id/alias of the package",
sizeContainer: sizeContainerRef.current as HTMLDivElement,
container: containerRef.current as HTMLDivElement,
videoRef: videoRef.current as HTMLVideoElement,
settings: {},
sizeContainer: "container",
playOverlay: true,
};
if (!webrtc_client) webrtc_client = new WebRTCClient(args);
});
Types and Props
Please follow to WebRTCClientProps
interface exported from module to check properties types
SizeContainer, container and videoRef