Giter VIP home page Giter VIP logo

Comments (2)

Gyanreyer avatar Gyanreyer commented on June 11, 2024 1

Hello, I apologize for taking so long to get back to this. I am assuming you found your own solution by now, but I will leave this comment for anyone who comes here in the future.

First, there is not a native way to achieve this behavior using only the hover-video-player component. You will need to build some custom stuff around it yourself, but it should hopefully be easier to do so now; previously, there were no APIs available for programmatically controlling playback state for hover-video-player components, but this is no longer the case as of v1.2.4.

Here is a code sandbox I made with a proof of concept for your described behavior.

To break down how I made this work...

I created a hover-video-player-group custom element which will grab all hover-video-player child elements and take control of them to ensure exactly one of them is always playing.

This leverages the following new features:

  • Sets an initial data-playback-state attribute on the first player in the group so it will auto-play
  • Sets all hover-video-player elements within the group to controlled mode
  • Calls .hover() and .blur() methods to programmatically start/stop playback

from hover-video-player.

iamritpal avatar iamritpal commented on June 11, 2024

Thanks Ryan appreciate it.

from hover-video-player.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.