Skip to content

how to know and limit quatity for video #267

Closed Answered by igordanchenko
thehien93 asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you for the clarification. Here is what you can do to address this in the current version of this library:

  1. Determine the device viewport size:
const [media, setMedia] = React.useState<"mobile" | "tablet" | "desktop">("desktop");

React.useEffect(() => {
  const updateMedia = () => {
    if (window.innerWidth <= 480) setMedia("mobile");
    else if (window.innerWidth <= 768) setMedia("tablet");
    else setMedia("desktop");
  };

  updateMedia();

  window.addEventListener("resize", updateMedia);

  return () => {
    window.removeEventListener("resize", updateMedia);
  };
}, []);
  1. Provide different video files depending on the viewport size:
slides={[
  {
    type: "video",
    s…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@thehien93
Comment options

@igordanchenko
Comment options

Answer selected by thehien93
@thehien93
Comment options

@igordanchenko
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants