How to fix CORB when i use youtube embedded video url? #16
-
hi, im using this library and got a warning like this Cross-Origin Read Blocking (CORB) blocked cross-origin response..... i use youtube embed video url like: https://www.youtube.com/embed/{videoId} is there any way to solve this? thank you :) |
Beta Was this translation helpful? Give feedback.
Answered by
igordanchenko
Aug 16, 2022
Replies: 1 comment 8 replies
-
The Video plugin supports raw video files (.mp4, .webm, etc.), but it sounds like you are trying to use YouTube iframe embed. You can render iframe video as a custom slide: https://codesandbox.io/s/yet-another-react-lightbox-16-bwx8nc <Lightbox
open={open}
close={() => setOpen(false)}
slides={[
{
type: "youtube",
src: "https://www.youtube.com/embed/aqz-KE-bpKQ",
title: "Big Buck Bunny",
width: 2160,
height: 1215
}
]}
render={{
slide: ({ type, src, width, height, title }, offset, rect) =>
type === "youtube" ? (
<iframe
width={Math.min(
width,
rect.width,
(width * rect.height) / height
)}
height={Math.min(
height,
rect.height,
(height * rect.width) / width
)}
src={src}
title={title}
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
></iframe>
) : null
}}
/> |
Beta Was this translation helpful? Give feedback.
8 replies
Answer selected by
igordanchenko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Video plugin supports raw video files (.mp4, .webm, etc.), but it sounds like you are trying to use YouTube iframe embed. You can render iframe video as a custom slide:
https://codesandbox.io/s/yet-another-react-lightbox-16-bwx8nc