Techassi / vue-youtube-iframe

Integrate the YouTube Iframe player into your Vue 3 app.
https://www.npmjs.com/package/@techassi/vue-youtube-iframe
12 stars 0 forks source link

Video ID doesn't work when using v-model #3

Closed ll931217 closed 3 years ago

ll931217 commented 3 years ago

Hello,

I am trying to use your plugin with a v-model that changes the video ID, here is the code in template (using pugjs):

youtube-iframe(
  v-show="projectData.url.video !== ''"
  :video-id="projectData.url.video",
  player-width="100%",
  player-height="300",
  :player-parameters="youtube.parameters"
)

however if I use a data variable, then the video shows up correctly.

Techassi commented 3 years ago

Hi,

what is the actual problem, or let me rephrase: what are you trying to accomplish? Can you also provide the rendered DOM (without pugjs)?

ll931217 commented 3 years ago

I have created a CodeSandbox for you to try it out, if you enter a video ID into the input field it does nothing but if you have it beforehand in the code then it works.

https://codesandbox.io/s/boring-dawn-rusv3

What I am trying to accomplish is having the user be able to enter the video ID they intend to use on the site and it will preview on the right.

ll931217 commented 3 years ago

All good, fixed it by looking through your source files. Using loadVideoById

Techassi commented 3 years ago

I would have suggested you to use the mentioned function... so great find!

Currently the player does not react to the change of the video id.

But I see the use-case to implement this functionality. I will add this feature to my list of TODOs which I consider to release in the next version 1.0.7