Skip to content

Commit de6e76f

Browse files
committed
doc: fix youtube example
1 parent bb8894a commit de6e76f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

docs/content/scripts/content/youtube-player.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Loading the YouTube Player SDK and interacting with it programmatically.
218218
const video = ref()
219219
const { onLoaded } = useScriptYouTubePlayer()
220220
221-
let player
221+
const player = ref(null)
222222
onLoaded(async ({ YT }) => {
223223
// we need to wait for the internal YouTube APIs to be ready
224224
const YouTube = await YT
@@ -233,12 +233,15 @@ onLoaded(async ({ YT }) => {
233233
videoId: 'd_IFKP1Ofq0'
234234
})
235235
})
236+
function play() {
237+
player.value?.playVideo()
238+
}
236239
</script>
237240
238241
<template>
239242
<div>
240243
<div ref="video" />
241-
<button @click="player.playVideo()">
244+
<button @click="play">
242245
Play
243246
</button>
244247
</div>

0 commit comments

Comments
 (0)