Skip to content

Commit

Permalink
doc: fix youtube example
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw committed Sep 11, 2024
1 parent bb8894a commit de6e76f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions docs/content/scripts/content/youtube-player.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ Loading the YouTube Player SDK and interacting with it programmatically.
const video = ref()
const { onLoaded } = useScriptYouTubePlayer()
let player
const player = ref(null)
onLoaded(async ({ YT }) => {
// we need to wait for the internal YouTube APIs to be ready
const YouTube = await YT
Expand All @@ -233,12 +233,15 @@ onLoaded(async ({ YT }) => {
videoId: 'd_IFKP1Ofq0'
})
})
function play() {
player.value?.playVideo()
}
</script>
<template>
<div>
<div ref="video" />
<button @click="player.playVideo()">
<button @click="play">
Play
</button>
</div>
Expand Down

0 comments on commit de6e76f

Please sign in to comment.