---
title: Quick start
sidebar_position: 1
slug: /
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
## Install
```bash
npm install artplayer
```
```js showLineNumbers
import Artplayer from 'artplayer';
const art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
});
```
```bash
yarn add artplayer
```
```js showLineNumbers
import Artplayer from 'artplayer';
const art = new Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
});
```
```html showLineNumbers
```
```js showLineNumbers
const art = new window.Artplayer({
container: '.artplayer-app',
url: '/assets/sample/video.mp4',
});
```
## Use
:::danger Tip
The size of the player depends on the size of the `container`, so your `container` must have a size.
:::
### Use in `Html`
```html showLineNumbers title="index.html"
ArtPlayer
```
### Use in `Vue.js` or `Nuxt.js`
🚀 [artplayer-template/vue.js](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-template/vue.js)
🚀 [artplayer-template/nuxt.js](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-template/nuxt.js)
```js showLineNumbers title="Artplayer.vue"
```
```js showLineNumbers title="App.vue"
```
### Use in `React.js` or `Next.js`
🚀 [artplayer-template/react.js](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-template/react.js)
🚀 [artplayer-template/next.js](https://github.com/zhw2590582/ArtPlayer/tree/master/packages/artplayer-template/next.js)
```jsx showLineNumbers title="ArtPlayer.jsx"
import { useEffect, useRef } from 'react';
import Artplayer from 'artplayer';
export default function Player({ option, getInstance, ...rest }) {
const artRef = useRef();
useEffect(() => {
const art = new Artplayer({
...option,
container: artRef.current,
});
if (getInstance && typeof getInstance === 'function') {
getInstance(art);
}
return () => {
if (art && art.destroy) {
art.destroy(false);
}
};
}, []);
return ;
}
```
```jsx showLineNumbers title="App.jsx"
import React from 'react';
import Artplayer from './ArtPlayer';
function App() {
return (
);
}
export default App;
```