davidjerleke / embla-carousel

A lightweight carousel library with fluid motion and great swipe precision.
https://www.embla-carousel.com
MIT License
5.39k stars 166 forks source link

[Bug]: Cannot swipe video elements as carousel items (slides) #678

Closed SaifOwleN closed 5 months ago

SaifOwleN commented 6 months ago

Bug is related to

Embla Carousel version

Describe the bug

cannot swipe video elements used as carousel items

CodeSandbox

https://codesandbox.io/p/sandbox/embla-carousel-default-react-forked-7zsrhv

Steps to reproduce

1- add a carousel slide item 2- add video element then try to swipe

Expected behavior

being able to swipe like normal carousel slide

davidjerleke commented 6 months ago

@SeifOwleN thanks for your bug report. Are the video elements iframes?

SaifOwleN commented 6 months ago

no, its just a normal video tag like this

 <video width="x" height="y" controls>
  <source src="movie.mp4" type="video/mp4">
  Placeholder
</video> 
davidjerleke commented 6 months ago

@SeifOwleN thanks. I wasn’t able to see the CodeSandbox for mysterious reasons.

Isn’t this how the HTML5 video tag is supposed to work? It will swallow any pointer events if the controls attribute is present. If you want it to be swipeable you need to remove the controls attribute and add custom controls.

Best, David

davidjerleke commented 5 months ago

@SeifOwleN have you read my comment?

SaifOwleN commented 5 months ago

sorry, haven't noticed. yeah i did search more and implemented a custom video player and it actually worked thanks 🥰

davidjerleke commented 5 months ago

@SeifOwleN thank you for confirming 👍!