Autoplay.pause() sets Autoplay.isPaused() as true but does not pause
Checks
- [X] Not a duplicate.
- [X] Not a question, feature request, or anything other than a bug report directly related to Splide. Use Discussions for these topics: https://github.com/Splidejs/splide/discussions
Version
3.2.6
Description
I'm trying to programmatically pause and play a splide instance, but the the pause() command does not appear to be working correctly. Relevant code:
var Autoplay = splide.Components.Autoplay;
if(conditionistrue){
Autoplay.play();
console.log(Autoplay.isPaused());
}
if(conditionisfalse){
Autoplay.pause();
console.log(Autoplay.isPaused());
}
The slideshow is paused, as expected, on load. When the condition is met, the slideshow plays as expected. But, after the slideshow plays once, when the condition is met to trigger Autoplay.pause(), Autoplay.isPaused() returns true, but the slideshow continues to play.
Reproduction Link
No response
Steps to Reproduce
- Programmatically play() slideshow
- Programmatically pause() slideshow
Expected Behaviour
When Autoplay.pause() is called, and Autoplay.isPaused() returns true, slideshow should stop playing.
It looks working in 3.2.6: https://codesandbox.io/s/autoplay-08rdd
Indeed; sorry for the false alarm. I believe it was the way I was managing it through IntersectionObserver was actually reinitializing it on every change.
Hmm I am also getting this but outside of the intersection observer...