Skip to main content

Frontend Packages

@onehop/client: The core library used by all other framework-specific packages. Can also be used independently.
@onehop/react: Our React-specific implementations for Pipe and Channels.

Integrating Pipe with a React App

Installing dependencies

Start off by adding both of our frontend packages to your project

Initializing the Hop SDK

Grab your project ID from the Project Settings page. You should call the init function outside of a React component. For example, in your application’s entrypoint file:

Integrating Pipe with React Hooks

The @onehop/react package exposes a collection of React hooks which allow you to easily implement product features into your app. We’ll focus on usePipeRoom in this section.

usePipeRoom

usePipeRoom takes in an object as it’s first and only argument, consisting of joinToken and ref, where ref is a React reference to a video element. Let’s jump into an example bare-minimum component:
As you can see, Pipe allows you to provide your own video element - Pipe just hooks into it and controls the video source and live scrubbing. This gives you flexibility to use any player wrapper or implement the video element however you want. usePipeRoom returns the following object:

Integrating Pipe with Vanilla JS