splide icon indicating copy to clipboard operation
splide copied to clipboard

Video Extension with React Splide

Open robbybuckets opened this issue 5 years ago • 6 comments

Not an issue, but a question. Is there a way to get the video extension to work with React Splide?

Thanks for any help anyone may be able to provide!

robbybuckets avatar Dec 22 '20 23:12 robbybuckets

Just wanted to follow up here. By any chance would someone know the answer to this?

Thanks in advance for any help you may be able to provide!

robbybuckets avatar Jan 05 '21 00:01 robbybuckets

You can follow this guide: https://splidejs.com/extension-video/ Or did you encounter an error following the guide?

tgrassl avatar Jan 25 '21 15:01 tgrassl

@tgrassl thanks for the response! I've followed that, but can't get it to work on the React Splide specifically. Is there a method for mounting it to the React Splide so that one can use the data-splide-youtube and data-splide-vimeo attributes?

robbybuckets avatar Jan 25 '21 21:01 robbybuckets

I created a working example for you: https://codesandbox.io/s/charming-euclid-jsztn?file=/src/App.js

You can add Extensions using the Extensions prop:

 <Splide
        options={SPLIDE_OPTIONS}
        Extensions={{ Video }}
 >

The only bug i found is that the "data" attributes are not being passed down to the SplideSlide component: https://github.com/Splidejs/react-splide/blob/master/src/js/components/SplideSlide.jsx#L18

I created a PR in the react-splide repo to fix this issue: https://github.com/Splidejs/react-splide/pull/11 ⭐

tgrassl avatar Jan 25 '21 22:01 tgrassl

Thank you so much! This is great!

robbybuckets avatar Jan 26 '21 02:01 robbybuckets

Close the issue due to the major version update. Feel free to create a new issue or open a new discussion.

NaotoshiFujita avatar Oct 09 '21 15:10 NaotoshiFujita