Skip to Main Content
Player Logo
PlayerPlugins

Getting Started

Getting started with Player is simple.

Install Dependencies

The first dependency you’ll need to pull in is the Player itself. Additionally, you’ll need an assets plugin to define any UI — we’ll use the reference assets as an example.
You can do this by running
yarn add @player-ui/react
yarn add @player-ui/reference-assets-plugin-react
or
npm install @player-ui/react
npm install @player-ui/reference-assets-plugin-react

Configuration

Next, in your code you’ll need to initialize Player. This is where you would also initialize any plugins you want to use with Player and create the configuration for Player itself. Below is a minimal example of this.
import { ReactPlayer } from '@player-ui/react';
import { ReferenceAssetsPlugin } from '@player-ui/reference-assets-plugin-react';

// create a new web-player instance

const reactPlayer = new ReactPlayer({
  plugins: [new ReferenceAssetsPlugin()],
});

Render Content

Now that you have a Player instance created. You’ll need to start it with some content.
const content = {/* your content here */}
reactPlayer.start(content);
With Player running your content, you’ll need to actually render out what is processes. To do this, you can use the React Player’s component API to insert it into your React tree.
const MyApp = () => {
  return <reactPlayer.Component />;
};
Congrats! You’ve got Player up and running. If you need additional functionality you can add more plugins to extend Player’s functionality. Head over to the Plugins section to take a look at the Plugins we’ve developed or take a look at the Architecture section to see how you can write your own.