andrewvasilchuk / vue-lazy-youtube-video

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

Ability to pause video? #25

Closed andrewcartwright1 closed 4 years ago

andrewcartwright1 commented 4 years ago

Hey,

I have just migrated to this from: https://github.com/kaorun343/vue-youtube-embed/

Was just wondering if this component had the ability to pause the video? If not, whats your thought's on requesting it as a feature/adding it as a feature :)?

My use case is, I have a slider with images and a youtube video, when i click to the next video/image or previous video/image - I would like to pause the video that I currently have open so that the video does not continue to play in the background.

andrewvasilchuk commented 4 years ago

@andrewcartwright1, So many people are asking for YT.Player access by now, so I'm considering to add a native support for YT.Player instance.

// variant 1
this.$refs.youtube.getPlayer().pauseVideo()

// variant 2
this.$refs.youtube.player.pauseVideo()

@andrewcartwright1, I'll implement that feature this week, but for now that's how you can create your own YT.Player instance.

Also take a look at #20

andrewcartwright1 commented 4 years ago

Thanks for getting back to me @andrewvasilchuk i'll check it out!

andrewvasilchuk commented 4 years ago

@andrewcartwright1, Sorry, I forgot about it – these change are not published yet. I'll publish them in an hour.

pranciskus commented 4 years ago

Any news on this? I have the exact same use case. Current hacky solution I am using is to increment a slide :key to re-render the video slide using @before-change event.

andrewvasilchuk commented 4 years ago

@pranciskus, @andrewcartwright1, You have to update to the latest version, and then refer to the FAQ.

andrewvasilchuk commented 4 years ago

Fixed in 2.2.0.