Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-youtube

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-youtube - npm Package Compare versions

Comparing version 1.0.3 to 1.0.5

2

package.json
{
"name": "vue-youtube",
"version": "1.0.3",
"version": "1.0.5",
"description": "A Vue.js Plugin",

@@ -5,0 +5,0 @@ "author": "Antério Vieira <anteriovieira@gmail.com>>",

@@ -29,10 +29,93 @@ # VueYoutube

<!-- Local files -->
<link rel="stylesheet" href="vue-youtube/dist/vue-youtube.css"></link>
<script src="vue-youtube/dist/vue-youtube.js"></script>
<!-- From CDN -->
<link rel="stylesheet" href="https://unpkg.com/vue-youtube/dist/vue-youtube.css"></link>
<script src="https://unpkg.com/vue-youtube"></script>
```
### Example
```html
<youtube :video-id="videoId" ref="player" @playing="playing"></youtube>
```
```js
{
data() {
return {
videoId: 'lG0Ys-2d4MA'
}
},
methods: {
playing() {
console.log('\o/ we are watching!!!')
}
},
computed: {
player () => this.$refs.youtube.player
},
mounted() {
this.player.playVideo()
}
}
```
or
```html
<youtube :video-id="videoId" :player-vars="playerVars" @playing="playing"></youtube>
```
```js
{
data() {
return {
videoId: 'lG0Ys-2d4MA',
playerVars: {
autoplay: 1
}
}
},
methods: {
playing() {
console.log('\o/ we are watching!!!')
}
}
}
```
### Events
The component triggers [events](https://developers.google.com/youtube/iframe_api_reference#Events) to notify the parent component of changes in the player. For more information, see [YouTube IFrame Player API](https://developers.google.com/youtube/iframe_api_reference#Events).
- ready
- ended
- playing
- paused
- buffering
- qued
- error
### Player
You have access to all [api methods](https://developers.google.com/youtube/iframe_api_reference#Functions) through [component referencing](https://vuejs.org/v2/api/#ref).
Example:
```html
<youtube video-id="lG0Ys-2d4MA" ref="youtube"></youtube>
```
```js
{
// ...
methods: {
playVideo() {
this.$refs.youtube.player.playVideo()
}
}
}
```
## Development

@@ -76,4 +159,9 @@

## TODO
- Tests
- Examples
## License
[MIT](http://opensource.org/licenses/MIT)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc