andrewvasilchuk / vue-lazy-youtube-video

Vue.js component for lazyloading YouTube videos.
MIT License
102 stars 22 forks source link

feat: add property to disable related videos #28

Closed franciscorode closed 4 years ago

franciscorode commented 4 years ago

First, congrats by the repo! I tried to disable related videos by adding rel option in playerOptions with playerVars but for some reason, it didn't work, the only way to make it work was to add it as a GET parameter in the src prop. To not set options in several sites I think is better to add it as a prop and I have added the changes to do it

andrewvasilchuk commented 4 years ago

@franciscorode, Thanks for the PR. You can pass src prop as 'https://www.youtube.com/embed/$ID?rel=0'. I've just checked it out and it works.

Note: that you can't disable related videos referring to the docs.

After the change, you will not be able to disable related videos. Instead, if the rel parameter is set to 0, related videos will come from the same channel as the video that was just played.

andrewvasilchuk commented 4 years ago

I don't think it's a good idea to introduce a separate prop for every parameter, since it will make component really large. Moreover you can pass any of them via src prop.

autoplay and enablejsapi props were introduce since they change the way how component behaves.

franciscorode commented 4 years ago

I understand your position, it's fine although I don't like the idea of ​​passing options in the URL. I tried to pass the option in prop playerOptions but I could not know why it did not work for me, other options work well such as events. If you find of good way to pass options outside of the URL and without overloading the properties component let me know I'll be happy to help

andrewvasilchuk commented 4 years ago

@franciscorode, We can add parameters prop, which can include all the parameters. All we need to do is correctly construct the URL.

franciscorode commented 4 years ago

Yes seem a good idea, I understand these points, tell me if you don't agree with some of them

andrewvasilchuk commented 4 years ago

@franciscorode, awesome!

franciscorode commented 4 years ago

Good! I can work on this, give me a few days and create another pull request, close this

andrewvasilchuk commented 4 years ago

@franciscorode, Thank you so much. I will be glad to review your PR.