@@ -204,10 +204,10 @@ export const getActiveMediaAtom = (
204204 ( { version } ) => version === mediaAtom . activeVersion ,
205205 ) ;
206206
207- const videoAssets = assets . filter (
207+ const firstVideoAsset = assets . filter (
208208 ( { assetType } ) => assetType === 'Video' ,
209- ) ;
210- if ( ! videoAssets . length ) return undefined ;
209+ ) [ 0 ] ;
210+ if ( ! firstVideoAsset ) return undefined ;
211211
212212 const image = decideMediaAtomImage (
213213 videoReplace ,
@@ -219,7 +219,7 @@ export const getActiveMediaAtom = (
219219 * Each version of a media atom will contain assets for self-hosted OR YouTube, but not both.
220220 * Therefore, we check the platform of the first asset and assume the rest are the same.
221221 */
222- if ( assets [ 0 ] ? .platform === 'Url' ) {
222+ if ( firstVideoAsset . platform === 'Url' ) {
223223 /**
224224 * Take one source for each supported video file type.
225225 */
@@ -249,20 +249,20 @@ export const getActiveMediaAtom = (
249249 } ) ) ,
250250 subtitleSource : subtitleAsset ?. id ,
251251 duration : mediaAtom . duration ?? 0 ,
252- width : mediaAtom . dimensions ?. width ?? 500 ,
253- height : mediaAtom . dimensions ?. height ?? 400 ,
252+ width : firstVideoAsset . dimensions ?. width ?? 500 ,
253+ height : firstVideoAsset . dimensions ?. height ?? 400 ,
254254 image,
255255 } ;
256256 }
257257
258258 /**
259259 * There should only be one asset for Youtube atoms.
260260 */
261- if ( assets [ 0 ] ? .platform === 'Youtube' ) {
261+ if ( firstVideoAsset . platform === 'Youtube' ) {
262262 return {
263263 type : 'YoutubeVideo' ,
264264 id : mediaAtom . id ,
265- videoId : assets [ 0 ] . id ,
265+ videoId : firstVideoAsset . id ,
266266 duration : mediaAtom . duration ?? 0 ,
267267 title : mediaAtom . title ,
268268 // Size fixed to a 5:3 ratio
0 commit comments