Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Splide Video on iOS need to double tap before video loads, android works with one tap #1345

Open
2 tasks done
squidiw opened this issue Dec 5, 2024 · 0 comments
Open
2 tasks done
Labels
bug Something isn't working

Comments

@squidiw
Copy link

squidiw commented Dec 5, 2024

Checks

Version

4.1.4

Description

I have a video slider and when on iOS when I click on the play button I have to hit the play icon twice before the video plays. But on Android that doesnt happen.

The version for the video package is "0.8.0"

Attached is gifs of how it works on android and iPhone using browserstack
CleanShot 2024-12-04 at 20 20 13
CleanShot 2024-12-04 at 20 21 25

Below is my code
`export const videoSlider = (element, Video, Splide) => {
if (!element) return;
const mainSlider = element.querySelector(".splide-video");
const thumbnailSlider = element.querySelector(".splide-video-thumbnails");

if (!mainSlider) return;

const main = new Splide(mainSlider, {
	type: "fade",
	rewind: true,
	pagination: false,
	arrows: false,
	height: "14.3125rem",
	mediaQuery: "min",
	breakpoints: {
		1024: {
			height: "30.25rem",
		},
	},
	video: {
		loop: false,
		mute: false,
		autoplay: false,
		playerOptions: {
			controls: true,
			clickToPlay: true,
			keyboard: true,
			playsInline: true,
		},
	},
});

main.on("click", () => {
	const isPlaying = mainSlider.classList.contains("is-playing");
	if (isPlaying) {
		main.Components.Video.pause(main.index);
	} else {
		main.Components.Video.play(main.index);
	}
});

let thumbnails;
if (thumbnailSlider) {
	thumbnails = new Splide(thumbnailSlider, {
		perPage: 4,
		rewind: true,
		gap: "0px",
		pagination: false,
		isNavigation: true,
		mediaQuery: "min",
		breakpoints: {
			1024: {
				perPage: 3,
			},
		},
	});
	main.sync(thumbnails);
}

main.mount({ Video });
if (thumbnails) {
	thumbnails.mount();
}

};
`

Reproduction Link

No response

Steps to Reproduce

Attached screen recording of how it happens

Expected Behaviour

On click the play icon on iOS the video should play immediately like how it does on Android.

@squidiw squidiw added the bug Something isn't working label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant