WebPlayer with Angular
Installation
When you use the Web Player as a dependency in your application, you need to update it whenever the package is updated, as it evolves frequently. See Updating to the Latest Version.
- npm
- Yarn
- pnpm
- Bun
npm install @car-cutter/angular-webplayer
yarn add @car-cutter/angular-webplayer
pnpm add @car-cutter/angular-webplayer
bun add @car-cutter/angular-webplayer
Usage
The package provides standalone components: import them in the imports of your component.
import { WebPlayer } from "@car-cutter/angular-webplayer";
Then, use the component as: <car-cutter-webplayer [compositionUrl]="url" />
Quick start
import { Component } from "@angular/core";
import { WebPlayer } from "@car-cutter/angular-webplayer";
@Component({
selector: "app-root",
imports: [WebPlayer],
template: `
<main>
<h1>Angular App</h1>
<div class="webplayer-wrapper">
<!-- highlight-start -->
<car-cutter-webplayer
compositionUrl="https://cdn.car-cutter.com/libs/web-player/v3/demos/composition.json"
infiniteCarrousel
(compositionLoaded)="onCompositionLoaded()"
/>
<!-- highlight-end -->
</div>
</main>
`,
styles: `
.webplayer-wrapper {
max-width: 800px;
margin-inline: auto;
}
`,
})
export class App {
onCompositionLoaded() {
console.log("Composition loaded");
}
}
The boolean properties can be set as bare attributes (infiniteCarrousel), or bound ([infiniteCarrousel]="true"). A property that isn't set keeps the player's default.
Customization
Custom medias and icons are given as content of the player, with the WebPlayerCustomMedia and WebPlayerIcon components, imported with WebPlayer:
import {
WebPlayer,
WebPlayerCustomMedia,
WebPlayerIcon,
} from "@car-cutter/angular-webplayer";
@Component({
// ...
imports: [WebPlayer, WebPlayerCustomMedia, WebPlayerIcon],
})
<car-cutter-webplayer [compositionUrl]="url">
<car-cutter-webplayer-custom-media [index]="4">
<img src="/custom-media.jpg" alt="Custom media" />
</car-cutter-webplayer-custom-media>
<car-cutter-webplayer-icon name="UI_GALLERY">
<svg viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" /></svg>
</car-cutter-webplayer-icon>
</car-cutter-webplayer>
Version Compatibility
This package requires Angular 19 or later. It works with and without zone.js.
Updating to the Latest Version
To update @car-cutter/angular-webplayer to the latest version, run:
- npm
- Yarn
- pnpm
- Bun
npm install @car-cutter/angular-webplayer@latest
yarn add @car-cutter/angular-webplayer@latest
pnpm add @car-cutter/angular-webplayer@latest
bun add @car-cutter/angular-webplayer@latest
You can check which version is currently installed with:
- npm
- Yarn
- pnpm
- Bun
npm list @car-cutter/angular-webplayer
yarn list --pattern "@car-cutter/angular-webplayer"
pnpm list @car-cutter/angular-webplayer
bun pm ls @car-cutter/angular-webplayer
After updating, rebuild your application to ensure the new version is picked up correctly.
Next steps
For more customization, take a look at available props in the Properties section