From e9853d3635b74b044351ccf811fdb2f3149432bb Mon Sep 17 00:00:00 2001
From: Antoine <antoine.roy@tetras-libre.fr>
Date: Tue, 19 Dec 2023 16:15:07 +0100
Subject: [PATCH] =?UTF-8?q?r=C3=A9cup=C3=A9ration=20de=20la=20dur=C3=A9e?=
 =?UTF-8?q?=20de=20la=20vid=C3=A9o=20utilis=C3=A9e=20par=20le=20Manifest?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/AnnotationCreation.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/AnnotationCreation.js b/src/AnnotationCreation.js
index c49b247..8252e8f 100644
--- a/src/AnnotationCreation.js
+++ b/src/AnnotationCreation.js
@@ -366,7 +366,12 @@ class AnnotationCreation extends Component {
       textEditorStateBustingKey, image, valueTime,
     } = this.state;
 
+    let mediaVideo;
+    // TODO : Vérifier ce code, c'est étrange de comprarer un typeof à une chaine de caractère.
     const mediaIsVideo = typeof VideosReferences.get(windowId) !== 'undefined';
+    if (mediaIsVideo) {
+      mediaVideo = VideosReferences.get(windowId);
+    }
 
     return (
       <CompanionWindow
@@ -406,6 +411,9 @@ class AnnotationCreation extends Component {
             { mediaIsVideo && (
             <>
               <Grid item xs={12} className={classes.paper}>
+                <Typography>
+                  {mediaIsVideo ? mediaVideo?.video.duration : null}
+                </Typography>
                 <Typography id="range-slider" variant="overline">
                   Display period
                 </Typography>
@@ -415,7 +423,7 @@ class AnnotationCreation extends Component {
                   valueLabelDisplay="auto"
                   aria-labelledby="range-slider"
                   getAriaValueText={this.valuetextTime}
-                  max={3000}
+                  max={mediaVideo ? mediaVideo.video.duration : null}
                   color="secondary"
                   classes={{
                     root: classes.MuiSliderColorSecondary,
-- 
GitLab