diff --git a/php/class-delivery.php b/php/class-delivery.php index 703618123..79f8c0402 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 ) { diff --git a/php/media/class-video.php b/php/media/class-video.php index f8a14d87e..739f8f6ba 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(