Skip to content

Commit 4800a32

Browse files
committed
add example
1 parent 8e729a8 commit 4800a32

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

play/Volume.vue

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<template lang="html">
2+
<container :title="title">
3+
<youtube :video-id="videoId" :mute="mute"></youtube>
4+
<div>
5+
<button @click="mute = !mute">toggle mute</button>
6+
</div>
7+
<div>{{ mute }}</div>
8+
</container>
9+
</template>
10+
11+
<script>
12+
import container from './container.vue'
13+
14+
export default {
15+
components: { container },
16+
data () {
17+
return {
18+
title: 'Volume',
19+
videoId: 'M7lc1UVf-VE',
20+
mute: true
21+
}
22+
}
23+
}
24+
</script>
25+
26+
<style lang="css">
27+
</style>

play/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import Size from './Size.vue'
55
import PlayerVars from './PlayerVars.vue'
66
import UpdateVideoId from './UpdateVideoId.vue'
77
import List from './List.vue'
8+
import Volume from './Volume.vue'
89

910
play('Vue YouTube Embed', module)
1011
.add('Events', Events)
1112
.add('Height and Width', Size)
1213
.add('Player Vars', PlayerVars)
1314
.add('Update Video ID', UpdateVideoId)
1415
.add('List', List)
16+
.add('Volume', Volume)

src/player.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ let pid = 0
55
export default {
66
props: {
77
playerHeight: {
8-
type: String,
8+
type: [String, Number],
99
default: '390'
1010
},
1111
playerWidth: {
12-
type: String,
12+
type: [String, Number],
1313
default: '640'
1414
},
1515
playerVars: {
@@ -76,6 +76,7 @@ export default {
7676
videoId,
7777
events: {
7878
onReady: (event) => {
79+
this.setMute(this.mute)
7980
this.$emit('ready', event.target)
8081
},
8182
onStateChange: (event) => {
@@ -88,8 +89,6 @@ export default {
8889
}
8990
}
9091
})
91-
92-
this.setMute()
9392
})
9493
},
9594
beforeDestroy () {

0 commit comments

Comments
 (0)