# vue-videojs

> a component wrap video.js for vue.js

Latest version **0.0.4** (published 2018-09-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-videojs
pnpm add vue-videojs
yarn add vue-videojs
bun add vue-videojs
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2018-09-13 |
| First published | 2018-09-11 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 83.5 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 2 |
| Author | kelen |
| Maintainers | imkelen |

## Links

- npm: https://www.npmjs.com/package/vue-videojs
- Repository: https://github.com/KELEN/vue-videojs
- Homepage: https://www.kelen.cc
- Issues: https://github.com/KELEN/vue-videojs/issues
- npm.io page: https://npm.io/package/vue-videojs

## Dependencies (1)

- [vue](https://npm.io/package/vue.md) ^2.4.4

## Recent versions

- 0.0.4 (latest) — 2018-09-13
- 0.0.3 — 2018-09-12
- 0.0.2 — 2018-09-11
- 0.0.1 — 2018-09-11

## README

# vue-videojs

> 基于[videojs](https://github.com/videojs/video.js)的封装，方便使用，无污染

### 安装

```
npm install video.js vue-videojs -S
```

### 引入vue-video组件

```javascript
import VVideo from 'vue-videojs'
// use global
Vue.use(VVideo);

// or use in component .vue
components: {
  VVideo
}
```

### 使用

```
<style lang="scss">
  .video-js {
    width: 600px;
    height: 400px;
  }
</style>
<template>
  <div id="app">
    <v-video ref="video" width="600" height="400"
         poster="//vjs.zencdn.net/v/oceans.png"
         class="video-js"
         webkit-playsinline
         playsinline
         x-webkit-airplay="allow"
         x5-video-player-type="h5"
         x5-video-player-fullscreen="true"
         x5-video-orientation="portraint"
         controls :sources="videos" :options="playOpts.options" @ready="videoReady" @ended="videoEnd"></v-video>
  </div>
</template>
<script>
export default {
  name: 'app',
  data () {
    return {
      videos: [
        'http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4',
      ],
      playOpts: {
        options: {
          controls: true,
          // autoplay: true,
          preload: 'auto',
          techOrder: ["html5"]
          // aspectRatio: "16:9"   // 配置了这个，class设置的样式无效
        }
      }
    }
  },
  methods: {
    videoEnd () {
      console.log('video end');
    },
    videoReady () {
      var video = this.$refs.video.videojsObject;
      // video.play();
    }
  }
}
</script>
```

#### 怎么videojs获取实例对象？

在ready回调里可以通过 ```this.$refs.video.videojsObject;``` 来获取videojs的实例对象

---
_Source: https://npm.io/package/vue-videojs · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
