# HTML

Use the rupa-player element in plain HTML with one script line from a CDN.

## Quick start

1. Add the script line to your page. It defines the `<rupa-player>` element.

   ```html
   <script type="module" src="https://cdn.jsdelivr.net/npm/@rupamotion/player@0.1.0/dist/element.js"></script>
   ```

2. Put `hero.rupaplay` (export as **Player file** in Rupamotion) next to your page.

3. Add the element where the animation goes:

   ```html
   <rupa-player src="hero.rupaplay"></rupa-player>
   ```

That's it: the animation plays.

## Need control?

The element's `player` is the player once the file is mounted, and `rupaready` says it is. Pause it from a button:

```html
<rupa-player src="hero.rupaplay"></rupa-player>
<button id="pause">Pause</button>
<script type="module">
	const el = document.querySelector("rupa-player");
	document.querySelector("#pause").addEventListener("click", () => el.player?.pause());
</script>
```

See [Control playback](/guides/control/) for `play`, `seek`, speed and states, and [Events](/guides/events/) for
`rupaready`, `rupaerror` and the player's own events.

## One element for every framework

There is no wrapper per framework: React uses the `/react` entry, plain JavaScript uses `mountFile` from `/file`, and
every other framework uses the `<rupa-player>` custom element from `/element`. The export dialog of Rupamotion writes
these lines for you (export as **Player file**, then **How to use**). Serve the `.rupaplay` file from your site.

## Lock the file

To lock the page to the exact file, add `integrity="sha256-..."` (shown by the export dialog) and update it after every
re-export. See [the file alone](/guides/file-alone/).
