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