Wappler Version : 3.9.5
Operating System : windows 10
Server Model: Nodejs
Database Type:mysql
Hosting Type: Heroku
Bootstrap 5
Expected behavior
What do you think should happen?
I am using a swiper to get to different content, when i swipe to get to a video, i expected that the video would play when it comes in view.
Actual behavior
What actually happens?
When I swipe to the video it doesnt play when it comes in view... I have to hit the play control to play it
How to reproduce
See screenshot with Video and swiper settings (note there are 2 videos slides 2 and 3 both with the same settings)
the live version can be seen at https://enienweb.herokuapp.com/home (as of 14.30 on 22/4/21 BST) it reflects the settings shown in screenshot for both videos, items 2 and 3 in the swiper.
I’ve tried a few things and im not getting the results i am expecting
Ive found the swiper - change event, that does trigger after each swipe - good
I’ve tried looking at the swiper.index (alert triggered after the swiper change) - but it always seems to be set to 0 so cant use to then play the specific indexed video - not as expected
I thought that a blunt approach may work so that after each swiper change I play the 2 videos (out of 4 - the other 2 being images) - this doesnt play the videos - not as expected
The only way that i can get the video to play is to use the play button on the control associated with the video.
I tried your fix, unfortunately it didnt work - see screenshot.
My guess is that as per an earlier comment the index doesnt seem to be set / updated ( as part of my multi-hour investigation i used the swiper change event to display the swiper1 index and it was always 0)
Not sure about that but i just created a test case locally and everything is working perfectly fine.
The easiest way to see the current index is in your browser console dmx.app.data or add {{swiper1.index}} on the page.
The solution i already suggested to you works perfectly fine in my test case, so does the active index.
Hi Teodor,
just started from scratch and re-created the swiper… still not working (also the slides arent centered but i can work that out once the fundamental problem is solved)
Please test with some basic settings first. For example, change that cube effect to slide and try again.
Probably these options (loop, 3d effects etc.) are causing the issues.
Hi Teodor,
Thanks … it partially works in slide mode… the videos load the first time they are swiped to but if you swipe back then it doesnt play again… i maybe able to live with this if there isnt something i can do about it?
What are you trying to do here is not entirely possible. The auto play attribute plays the video once, not every time.
Maybe swiper with video players inside is not the most suitable combination in your case.
Hi, I know that this is an old thread, but I’ve tried an option of using JavaScript to detect when a block is in viewport.
By using the “endTransition” event listener, it’ll play the video if the video is in viewport after the slide has finished its transition. Hopefully this method works for you as well.