Skip to content

Commit

Permalink
fix(h5p-webcomponents): fallback for right metadata (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
sr258 committed Nov 17, 2021
1 parent fa642fd commit c46a4bc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions packages/h5p-webcomponents/src/h5p-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,16 @@ export class H5PPlayerComponent extends HTMLElement {
);
return undefined;
}
if (
!this.h5pInstance.contentData ||
!this.h5pInstance.contentData.metadata
) {
return undefined;

let metadata = this.h5pInstance.contentData?.metadata;
if (!metadata) {
metadata =
this.playerModel.integration.contents[
`cid-${this.playerModel.contentId}`
].metadata;
if (!metadata) {
return undefined;
}
}

let parameters: any;
Expand Down Expand Up @@ -255,7 +260,7 @@ export class H5PPlayerComponent extends HTMLElement {
this.h5pInstance,
parameters,
this.playerModel.contentId,
this.h5pInstance.contentData.metadata
metadata
);
}

Expand Down

0 comments on commit c46a4bc

Please sign in to comment.