File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
docs/content/scripts/content Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ Loading the YouTube Player SDK and interacting with it programmatically.
218
218
const video = ref()
219
219
const { onLoaded } = useScriptYouTubePlayer()
220
220
221
- let player
221
+ const player = ref(null)
222
222
onLoaded(async ({ YT }) => {
223
223
// we need to wait for the internal YouTube APIs to be ready
224
224
const YouTube = await YT
@@ -233,12 +233,15 @@ onLoaded(async ({ YT }) => {
233
233
videoId: 'd_IFKP1Ofq0'
234
234
})
235
235
})
236
+ function play() {
237
+ player.value?.playVideo()
238
+ }
236
239
</script>
237
240
238
241
<template>
239
242
<div>
240
243
<div ref="video" />
241
- <button @click="player.playVideo() ">
244
+ <button @click="play ">
242
245
Play
243
246
</button>
244
247
</div>
You can’t perform that action at this time.
0 commit comments