Skip to main content

WebPlayer with React.js

Installation

npm install @car-cutter/react-webplayer

Usage

import { WebPlayer } from "@car-cutter/react-webplayer";

Then, use the component as: <WebPlayer compositionUrl={url} />

Quick start

/src/App.jsx
import { WebPlayer } from "@car-cutter/react-webplayer";

const App = () => {
return (
<main>
<h1>React App</h1>
<WebPlayer
style={{ maxWidth: "800px", marginInline: "auto", marginTop: "16px" }}
compositionUrl="https://cdn.car-cutter.com/libs/web-player/v3/demos/composition.json"
infiniteCarrousel
onCompositionLoaded={() => console.log("Composition loaded")}
/>
</main>
);
};

export default App;

Version Compatibility

  • React 18 and above: Use the default import from @car-cutter/react-webplayer
  • React 16.8 to 17.x: Use the legacy import from @car-cutter/react-webplayer/legacy
  • React versions below 16.8 are not supported

Next steps

For more customisation, take a look at available props in the Properties section