diff --git a/src/components/VideoViewer.js b/src/components/VideoViewer.js index 6dd39e8be039efda095846e22dc77d4dd44b9125..a6a7518f6d45cfea5ba12b47ae5aea911314ca4c 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 (