Media: Fix JS TypeError with video playlists and native video.

Verify that the `resized` property exists on a video in the playlist before attempting to read it. Prevent a TypeError from being thrown and breaking the playlist if a video type requires native video support.

Props afercia, here.
Fixes #47513.

git-svn-id: https://develop.svn.wordpress.org/trunk@54279 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Joe Dolson 2022-09-21 15:28:56 +00:00
parent 2653c8e510
commit 235befac17

View File

@ -85,8 +85,10 @@
if ( this.data.images && this.current.get( 'image' ) && -1 === this.current.get( 'image' ).src.indexOf( defaultImage ) ) {
this.playerNode.attr( 'poster', this.current.get( 'image' ).src );
}
dimensions = this.current.get( 'dimensions' ).resized;
this.playerNode.attr( dimensions );
dimensions = this.current.get( 'dimensions' );
if ( dimensions && dimensions.resized ) {
this.playerNode.attr( dimensions.resized );
}
} else {
if ( ! this.data.images ) {
this.current.set( 'image', false );