Skip to content

Commit 8f91274

Browse files
author
otakodes
committed
🚧 adapted demo to new API
1 parent 8933c26 commit 8f91274

File tree

2 files changed

+25
-16
lines changed

2 files changed

+25
-16
lines changed

demo/demo.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,18 @@ <h1>Vue Youtube Iframe Api Player</h1>
1313

1414
<p><input placeholder="add a url" v-model="url"></p>
1515
<p><input placeholder="add an id" v-model="id"></p>
16+
<p><input placeholder="add a quality" v-model="quality"></p>
1617

1718
<vytia-player
1819
ref="p"
19-
:ytid="id"
20-
:yturl="url"
21-
:player-vars="{controls: 0}"
22-
@read="onPlayerReady"
20+
:id="id"
21+
:url="url"
22+
start-at="120"
23+
end-at="130"
24+
:player-vars="{controls: 0, autoplay: 1}"
25+
:quality="quality"
26+
@playback-quality-change="onQualityChange"
27+
@ready="onPlayerReady"
2328
>
2429
</vytia-player>
2530

demo/main.js

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,31 @@
1-
import Vue from 'vue/dist/vue.min.js'
2-
import VuePlayer from '../src/main'
1+
import Vue from 'vue/dist/vue.min.js';
2+
import VuePlayer from '../src/main';
33

4-
Vue.use(VuePlayer)
4+
Vue.use(VuePlayer);
55

66
new Vue({
77
el: '#app',
88

99
data () {
1010
return {
1111
url: null,
12-
id: null
13-
}
12+
id: null,
13+
quality: null,
14+
};
1415
},
1516

1617
methods: {
17-
onPlayerReady () {
18-
console.log(this.$refs.p.player)
18+
onPlayerReady() {
19+
window.player = this.$refs.p.player;
20+
},
21+
onQualityChange(event) {
22+
console.log('quality', event);
1923
},
2024
play() {
21-
this.$refs.p.player.playVideo()
25+
this.$refs.p.player.playVideo();
2226
},
2327
pause() {
24-
this.$refs.p.player.pauseVideo()
25-
}
26-
}
27-
})
28+
this.$refs.p.player.pauseVideo();
29+
},
30+
},
31+
});

0 commit comments

Comments
 (0)