From b11d8c4dfe2ec6c9c9f3cb4c10c9ca1d6a330b84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFs=20Poujade?= <lois.poujade@tetras-libre.fr> Date: Wed, 30 Nov 2022 10:23:04 +0100 Subject: [PATCH] Fix subtitles files in annotations --- src/components/VideoViewer.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/VideoViewer.js b/src/components/VideoViewer.js index 6dd39e8b..a6a7518f 100644 --- a/src/components/VideoViewer.js +++ b/src/components/VideoViewer.js @@ -28,10 +28,10 @@ export class VideoViewer extends Component { setPaused(true); const vttContent = flatten( flattenDeep([ - annotations.map(annotation => annotation.resources.map( + annotations.map(annotation => annotation._items.map( resources_ => resources_.resource, )), - ]).filter(resource => resource.body && resource.body[0] && resource.body[0].format === 'text/vtt'), + ]).filter(resource => resource.body && resource.body.format === 'text/vtt'), ); if (vttContent && vttContent.length > 0) { setHasTextTrack(true); @@ -140,10 +140,10 @@ export class VideoViewer extends Component { ); const vttContent = flatten( flattenDeep([ - annotations.map(annotation => annotation.resources.map( + annotations.map(annotation => annotation._items.map( resources_ => resources_.resource, )), - ]).filter(resource => resource.body && resource.body[0] && resource.body[0].format === 'text/vtt'), + ]).filter(resource => resource.body && resource.body.format === 'text/vtt'), ); // Only one video can be displayed at a time in this implementation. @@ -155,7 +155,8 @@ export class VideoViewer extends Component { let caption = null; if (vttContent && vttContent.length > 0) { caption = { - id: vttContent[0].body[0].id, + id: vttContent[0].body.id, + lang: vttContent[0].body.language, }; } return ( -- GitLab