Skip to content

Commit

Permalink
change the argument of events
Browse files Browse the repository at this point in the history
  • Loading branch information
kaorun343 committed Jun 15, 2018
1 parent 21c57af commit b35b3d1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Vue YouTube Embed

This is a component for Vue.js to utilize YouTube iframe API easily.
This is based on [Angular YouTube Embed](http:https://brandly.github.io/angular-youtube-embed/)

## License

MIT License

## install
Expand Down Expand Up @@ -42,14 +44,17 @@ Please pass the ID of the video that you'd like to show.
### Props

These are available props.

* `player-width`: `String` or `Number`, default value is `640`
* `player-height`: `String` or `Number`, default value is `390`
* `player-vars`: `Object`, default value is `{start: 0, autoplay: 0}` Can also specify `rel` and `showInfo`
* `video-id`: `String`, `required`
* `mute`: `Boolean` default value is `false`

### Methods

These functions are the same as the original one.

* `getIdFromURL`
* `getTimeFromURL`

Expand All @@ -60,6 +65,7 @@ let startTime = getTimeFromURL(url)
```

or

```js
export default {
methods: {
Expand All @@ -72,7 +78,9 @@ export default {
```

### Events

These are the events that will be emitted by the component.

* `ready`
* `ended`
* `playing`
Expand All @@ -81,7 +89,7 @@ These are the events that will be emitted by the component.
* `qued`
* `error`

The first argument is an instance of `YT.Player`.
The first argument contains the instance of `YT.Player` at the parameter `target`.

### The way of start playing video automatically

Expand Down Expand Up @@ -149,7 +157,9 @@ const app = new Vue({
```

## Usage with Nuxt SSR

To get this component working with Nuxt, wrap it in Nuxt's [`no-ssr` component](https://nuxtjs.org/api/components-no-ssr/).

## Contribution
* contribution welcome!

contribution welcome!
6 changes: 3 additions & 3 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ export default {
events: {
onReady: (event) => {
this.setMute(this.mute)
this.$emit('ready', event.target)
this.$emit('ready', event)
},
onStateChange: (event) => {
if (event.data !== -1) {
this.$emit(container.events[event.data], event.target)
this.$emit(container.events[event.data], event)
}
},
onError: (event) => {
this.$emit('error', event.target)
this.$emit('error', event)
}
}
})
Expand Down

0 comments on commit b35b3d1

Please sign in to comment.