Skip to content

Commit

Permalink
add example
Browse files Browse the repository at this point in the history
  • Loading branch information
kaorun343 committed Mar 18, 2017
1 parent 8e729a8 commit 4800a32
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
27 changes: 27 additions & 0 deletions play/Volume.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template lang="html">
<container :title="title">
<youtube :video-id="videoId" :mute="mute"></youtube>
<div>
<button @click="mute = !mute">toggle mute</button>
</div>
<div>{{ mute }}</div>
</container>
</template>

<script>
import container from './container.vue'
export default {
components: { container },
data () {
return {
title: 'Volume',
videoId: 'M7lc1UVf-VE',
mute: true
}
}
}
</script>

<style lang="css">
</style>
2 changes: 2 additions & 0 deletions play/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import Size from './Size.vue'
import PlayerVars from './PlayerVars.vue'
import UpdateVideoId from './UpdateVideoId.vue'
import List from './List.vue'
import Volume from './Volume.vue'

play('Vue YouTube Embed', module)
.add('Events', Events)
.add('Height and Width', Size)
.add('Player Vars', PlayerVars)
.add('Update Video ID', UpdateVideoId)
.add('List', List)
.add('Volume', Volume)
7 changes: 3 additions & 4 deletions src/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ let pid = 0
export default {
props: {
playerHeight: {
type: String,
type: [String, Number],
default: '390'
},
playerWidth: {
type: String,
type: [String, Number],
default: '640'
},
playerVars: {
Expand Down Expand Up @@ -76,6 +76,7 @@ export default {
videoId,
events: {
onReady: (event) => {
this.setMute(this.mute)
this.$emit('ready', event.target)
},
onStateChange: (event) => {
Expand All @@ -88,8 +89,6 @@ export default {
}
}
})

this.setMute()
})
},
beforeDestroy () {
Expand Down

0 comments on commit 4800a32

Please sign in to comment.