Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@arcware/webrtc-plugin

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcware/webrtc-plugin

Javascript/Typescript module to connect any frontend to Unreal Engine 4 app with pixel streaming enabled through signalling WS.

  • 0.3.0
  • npm
  • Socket score

Version published
Weekly downloads
721
increased by26.94%
Maintainers
2
Weekly downloads
 
Created
Source

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";
// Vue template
<div ref="sizeContainer">
  <div ref="videoContainer">
    <video ref="videoRef" />
  </div>
</div>
// React template
const sizeContainerRef = React.useRef();
const containerRef = React.useRef();
const videoRef = React.useRef();

<div ref={sizeContainerRef}>
  <div ref={containerRef}>
    <video ref={videoElRef} />
  </div>
</div>;
// Angular template

<div #sizeContainer>
  <div #container>
    <video #videoEl></video>
  </div>
</div>

@ViewChild("videoEl") inputVideo!: ElementRef;
@ViewChild("container") container!: ElementRef;
@ViewChild("sizeContainer") sizeContainer!: ElementRef;

// Initialize WebRTC

const args = {
  address: "Signalling WS URL",
  packageId: "Name of the package (if there are multiple applications)",
  settings: {},
  // --- Containers Options ---
  // Vue
  sizeContainer: this.$refs.sizeContainer,
  container: this.$refs.videoContainer,
  videoRef: this.$refs.videoRef,
  // React
  sizeContainer: sizeContainerRef.current,
  container: containerRef.current,
  videoRef: videoRef.current,
  // Angular
  sizeContainer: this.sizeContainer.nativeElement,
  container: this.container.nativeElement,
  videoRef: this.inputVideo.nativeElement,
  // ---  ---
  playOverlay: true, // Set default overlay with play button. Make it false and use loader
  loader: (val) => {}, // Callback for loading screen, etc. Once stream is ready, the function will be triggered with false value.
  applicationResponse: (response) => {}, // Callback for Unreal Engine application messages.
};

const webrtc_client = new WebRTCClient(args);
const emitUIInteraction = webrtc_client.emitUIInteraction; // Method to send descriptors to UE4 app
// <script> with index.html example implementation
<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>
// React/Next example implementation

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,
  };

  // it's protection from double-load, due to React 18 double-render feature on dev environment.
  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

FAQs

Package last updated on 28 Sep 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc