fix: vidéos ne marche plus sur les pages résistants

proto-module-actu-react
Jalil Arfaoui 2023-09-09 01:36:41 +02:00
parent 5982b04bb5
commit 4160039833
2 changed files with 6 additions and 5 deletions

View File

@ -1,2 +1,5 @@
export const getYoutubeLink = (id: string): string =>
`https://www.youtube.com/watch?v=${id}`;
export const getYoutubeEmbedLink = (id: string): string =>
`https://www.youtube-nocookie.com/embed/${id}`;

View File

@ -1,17 +1,17 @@
import { useContext } from "react";
import { useNavigate, useParams } from "react-router";
import { AspectRatio } from "@mantine/core";
import { getResistantPhotoUrl } from "../getResistantPhotoUrl";
import { resistants } from "../resistants";
import { getResistantsPageUrl } from "../getResistantsPageUrl";
import { HomeContext } from "../context/HomeContext";
import { AspectRatio } from "@mantine/core";
import { ExternalLink } from "../components/ExternalLink";
import {
getResistantDateDeclarationMoisAnnee,
getResistantDateFinMoisAnnee,
isAncienResistant,
isResistantActif,
} from "../Resistant";
import { getYoutubeEmbedLink } from "../Youtube";
export const PageResistant = () => {
const { idResistant } = useParams();
@ -172,9 +172,7 @@ export const PageResistant = () => {
style={{ marginLeft: "auto", marginRight: "auto" }}
>
<iframe
src={`https://www.youtube-nocookie.com/embed/${
resistant.video.split("watch?v=")[1]
}`}
src={getYoutubeEmbedLink(resistant.video)}
width="100%"
height="100%"
title="YouTube video player"