From 3094049ead00d8252ca77facc82f61dbe16d518d Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov Date: Thu, 7 Aug 2025 11:58:43 +0300 Subject: [PATCH 1/2] Fix webm audio files --- php/class-delivery.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/php/class-delivery.php b/php/class-delivery.php index 70361812..79f8c040 100644 --- a/php/class-delivery.php +++ b/php/class-delivery.php @@ -387,6 +387,11 @@ public function is_deliverable( $attachment_id ) { if ( $is ) { $meta = wp_get_attachment_metadata( $attachment_id, true ); $is = ! empty( $meta['width'] ) && ! empty( $meta['height'] ); + + // Webm audio files don't have width and height. + if ( ! $is && ! empty( $meta['mime_type'] ) && 'audio/webm' === $meta['mime_type'] ) { + $is = true; + } } if ( ! $is ) { From 43c7620008df4c4e48921a761682b6e2fc95fa35 Mon Sep 17 00:00:00 2001 From: Aleksandar Atanasov Date: Tue, 2 Sep 2025 15:05:49 +0300 Subject: [PATCH 2/2] Change the video source types for audio/webm --- php/media/class-video.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/php/media/class-video.php b/php/media/class-video.php index f8a14d87..739f8f6b 100644 --- a/php/media/class-video.php +++ b/php/media/class-video.php @@ -389,6 +389,7 @@ protected function build_video_embed( $source, $attributes = array(), $overwrite // If it is an attachment, get the video metadata. if ( $attachment_id ) { + // Check for transformations. $transformations = $this->media->get_transformations( $attachment_id, array(), $overwrite_transformations ); if ( ! empty( $transformations ) ) { @@ -410,6 +411,12 @@ protected function build_video_embed( $source, $attributes = array(), $overwrite ); $params['source']['transformation'] = array_merge( $streaming_transform, $transformations ); } + + $meta = wp_get_attachment_metadata( $attachment_id, true ); + + if ( ! empty( $meta['mime_type'] ) && 'audio/webm' === $meta['mime_type'] ) { + $params['source']['source_types'] = array( 'audio' ); + } } $video_defaults = array(