# vue-video-module

> a video component built for vue

Latest version **0.4.6** (published 2017-11-18) · ISC license · 0 weekly downloads

## Install

```sh
npm install vue-video-module
pnpm add vue-video-module
yarn add vue-video-module
bun add vue-video-module
```

## 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.4.6 |
| Published | 2017-11-18 |
| First published | 2017-03-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 17 |
| Author | iapyang |
| Maintainers | iapyang |
| Keywords | vue, vue components, video |

## Links

- npm: https://www.npmjs.com/package/vue-video-module
- Repository: https://github.com/iapYang/vue-video-module
- Homepage: https://github.com/iapYang/vue-video-module#readme
- Issues: https://github.com/iapYang/vue-video-module/issues
- npm.io page: https://npm.io/package/vue-video-module

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 0.4.6 (latest) — 2017-11-18
- 0.4.5 — 2017-09-07
- 0.4.4 — 2017-09-07
- 0.4.3 — 2017-04-26
- 0.4.2 — 2017-04-21
- 0.4.1 — 2017-04-04
- 0.4.0 — 2017-04-03
- 0.3.6 — 2017-03-30
- 0.3.5 — 2017-03-29
- 0.3.4 — 2017-03-29
- 0.3.3 — 2017-03-25
- 0.3.2 — 2017-03-23
- 0.3.1 — 2017-03-22
- 0.3.0 — 2017-03-20
- 0.2.2 — 2017-03-17
- … 4 more at https://npm.io/package/vue-video-module/versions

## README

[![GitHub issues](https://img.shields.io/github/issues/iapYang/vue-video-module.svg?style=flat-square)](https://github.com/iapYang/vue-video-module/issues)
[![GitHub forks](https://img.shields.io/github/forks/iapYang/vue-video-module.svg?style=flat-square)](https://github.com/iapYang/vue-video-module/network)
[![GitHub stars](https://img.shields.io/github/stars/iapYang/vue-video-module.svg?style=flat-square)](https://github.com/iapYang/vue-video-module/stargazers)

[![NPM](https://nodei.co/npm/vue-video-module.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/vue-video-module/)

[![NPM](https://nodei.co/npm-dl/vue-video-module.png?months=3&height=2)](https://nodei.co/npm/vue-video-module/)

# vue-video-module

A simple video component built for vue.

Work fine on IE 11+, Chrome, firefox, ipad and it's mobile friendly.

### Warning

For umd users, due to webpack2 compile changes. The module export compile way changes, so you have no choice but set `VueVideo = VueVideo.default` at the begining.

### Changelog

> v0.4.6
>
> 🐛 Bug Fix
>
> - Fix [#2](https://github.com/iapYang/vue-video-module/issues/2)

[Log Page](https://github.com/iapYang/vue-video-module/blob/master/CHANGELOG.md)

### Example

[Demo Page](https://iapyang.github.io/vue-video-module/)

### Test
[Test Page](https://iapyang.github.io/vue-video-module/#/test)

### Usage

#### Install vue-video-module

`npm install vue-video-module -D`

#### Vue use

```javascript
// import
import Vue from 'vue';
import VueVideo from 'vue-video-module';

// require
var Vue = require('Vue');
var VueVideo = require('vue-video-module');

// mount with component
export default {
  components: {
    VueVideo,
  },
};
```

#### Use in component

```vue
<div class="video-container">
  <vue-video ref="video1" :options="videoOptions"></vue-video>
</div>
```

```javascript
// e.g
videoOptions: {
  src: 'http://vjs.zencdn.net/v/oceans.mp4',
  poster: 'http://www.freemake.com/blog/wp-content/uploads/2015/06/videojs-logo.jpg',
  controlBar: true,
  spinner: 'circles',
  fullscreen: true,
},
```

### API

#### Props

Below are properties you can use in videoOptions to construct your own video.

If the value is false means this part will not be rendered.

| Name               | Description                              | Value             | Default   |
| ------------------ | ---------------------------------------- | ----------------- | --------- |
| src                | the source of video                      | string (required) | null      |
| poster             | the poster of the video                  | string \|\| false | false     |
| playMain           | the source of main play button           | string \|\| false | base64    |
| playMainRollover   | the source of main play button rollover state | string \|\| false | base64    |
| replayMain         | the source of main replay button         | string \|\| false | base64    |
| replayMainRollover | the source of main replay button rollover state | string \|\| false | base64    |
| playSub            | the source of play button in the video control bar | string            | base64    |
| pauseSub           | the source of pause button in the video control bar | string            | base64    |
| replaySub          | the source of replay button in the video control bar | string            | base64    |
| fullscreen         | if fullscreen part shown                 | bool              | true      |
| fullscreenSub      | the source of full screen button in the video control bar | string \|\| false | base64    |
| shrinkscreenSub    | the source to shrink screen to normal size, button in the video control bar | string            | base64    |
| autoPlay           | if the video auto play                   | bool              | false     |
| loop               | loop video                               | bool              | false     |
| muted              | muted video                              | bool              | false     |
| controlBar         | if show the controlbar                   | bool              | true      |
| spinner            | the loading style, check [here](https://github.com/iapYang/vue-simple-loading) | string            | 'circles' |
| volume             | show the volume controller               | bool              | true      |
| aspect             | define the video's width and height, an object with 'width' and 'height' property, see example4 for details | object \|\| false | false     |
| endFrame           | show when last frame is shown            | string \|\| false | false     |
| bufferingBar       | show the buffering state of the video    | bool              | false     |
| timeProgress       | show currentTime & totalTime when playing | bool              | false     |
#### Events

##### brief：

the `vueVideo` is the object of this component

`vueVideo.$refs.video` is the dom of the video

```vue
// e.g
<vue-video :options="videoOptions" ref="video" @init="initHandler"></vue-video>
```

| Name            | Description                              | Type     |
| --------------- | ---------------------------------------- | -------- |
| init(vueVideo)  | be called after the video is initialed. PS: if the video src is changed, this event will fire again. | function |
| play(vueVideo)  | video status from pause to play          | function |
| pause(vueVideo) | video status from play to pause          | function |
| start(vueVideo) | video start                              | function |
| end(vueVideo)   | video end                                | function |
#### Methods

##### brief：

the `vueVideo` is the object of this component

```javascript
// e.g
vueVideo.play();
```

| Name            | Description                              | parameter |
| --------------- | ---------------------------------------- | --------- |
| play()          | make the video play                      | null      |
| pause()         | make the video pause                     | null      |
| replay()        | make the video replay                    | null      |
| seek(rate)      | 0 <= rate <= 1, jump to a ponit          | number    |
| change(options) | if you want to the props after you create it, use this function. | object    |
| reset()         | reset to original state                  | null      |
| loadPoster()    | process to load the poster               | null      |

### Todo List

- [x] add options for manually set width and height
- [x] add last frame 
- [x] add buffering state to progress bar

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