Skip to content

Commit

Permalink
Use id from AudioBlockElement for media-id if available
Browse files Browse the repository at this point in the history
  • Loading branch information
arelra committed Jan 7, 2025
1 parent 1a4b51b commit 0b6a262
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dotcom-rendering/src/lib/audio-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const getAudioData = (
element._type ===
'model.dotcomrendering.pageElements.AudioBlockElement',
);
if (audioBlockElement?.assets[0] && audioBlockElement.elementId) {
if (audioBlockElement?.assets[0] && audioBlockElement.id) {
return {
audioDownloadUrl: audioBlockElement.assets[0].url,
mediaId: audioBlockElement.elementId,
mediaId: audioBlockElement.id,
};
}
return undefined;
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/model/article-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -841,6 +841,9 @@
"type": "string",
"const": "model.dotcomrendering.pageElements.AudioBlockElement"
},
"id": {
"type": "string"
},
"elementId": {
"type": "string"
},
Expand Down
3 changes: 3 additions & 0 deletions dotcom-rendering/src/model/block-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,9 @@
"type": "string",
"const": "model.dotcomrendering.pageElements.AudioBlockElement"
},
"id": {
"type": "string"
},
"elementId": {
"type": "string"
},
Expand Down
1 change: 1 addition & 0 deletions dotcom-rendering/src/types/content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface AudioAtomBlockElement {

interface AudioBlockElement {
_type: 'model.dotcomrendering.pageElements.AudioBlockElement';
id?: string;
elementId: string;
assets: AudioAsset[];
}
Expand Down

0 comments on commit 0b6a262

Please sign in to comment.