Skip to content
Snippets Groups Projects
Verified Commit b11d8c4d authored by Loïs Poujade's avatar Loïs Poujade
Browse files

Fix subtitles files in annotations

parent 909b4119
No related branches found
No related tags found
No related merge requests found
...@@ -28,10 +28,10 @@ export class VideoViewer extends Component { ...@@ -28,10 +28,10 @@ export class VideoViewer extends Component {
setPaused(true); setPaused(true);
const vttContent = flatten( const vttContent = flatten(
flattenDeep([ flattenDeep([
annotations.map(annotation => annotation.resources.map( annotations.map(annotation => annotation._items.map(
resources_ => resources_.resource, 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) { if (vttContent && vttContent.length > 0) {
setHasTextTrack(true); setHasTextTrack(true);
...@@ -140,10 +140,10 @@ export class VideoViewer extends Component { ...@@ -140,10 +140,10 @@ export class VideoViewer extends Component {
); );
const vttContent = flatten( const vttContent = flatten(
flattenDeep([ flattenDeep([
annotations.map(annotation => annotation.resources.map( annotations.map(annotation => annotation._items.map(
resources_ => resources_.resource, 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. // Only one video can be displayed at a time in this implementation.
...@@ -155,7 +155,8 @@ export class VideoViewer extends Component { ...@@ -155,7 +155,8 @@ export class VideoViewer extends Component {
let caption = null; let caption = null;
if (vttContent && vttContent.length > 0) { if (vttContent && vttContent.length > 0) {
caption = { caption = {
id: vttContent[0].body[0].id, id: vttContent[0].body.id,
lang: vttContent[0].body.language,
}; };
} }
return ( return (
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment