Comments (2)
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 tocontrolled
mode - Calls
.hover()
and.blur()
methods to programmatically start/stop playback
from hover-video-player.
Thanks Ryan appreciate it.
from hover-video-player.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hover-video-player.