# The file alone

Load a .rupaplay file with the rupa-player element and let it write the markup and CSS.

```html
<rupa-player src="/hero.rupaplay" integrity="sha256-..." cloak></rupa-player>
<script type="module" src="https://cdn.jsdelivr.net/npm/@rupamotion/player@0.1.0/dist/element.js"></script>
```

The element loads the file, writes its markup and CSS, and mounts the player (`element.player`). `cloak` keeps the
root hidden until the CSS is installed. `integrity` locks the page to the exact file: the player refuses a file that was
changed, and you update the value after every re-export.

```js
import { mountFile } from "@rupamotion/player/file";

const { player } = await mountFile(document.querySelector("#card-flip"), "/card-flip.rupaplay", { markup: "replace" });
player.play("flip");
```

The element reports on itself with two events:

```js
const el = document.querySelector("rupa-player");
el.addEventListener("rupaready", () => el.player.play()); // the file is loaded and the player mounted
el.addEventListener("rupaerror", (event) => console.warn(event.detail.error.code)); // a failed load
```

`mountFile` sends the same `rupaerror` on its root. The `error` event of a `Player` exists only after a successful
mount. See the [element reference](/reference/rupa-player-element/) for every attribute.
