Skip to content

Commit 43c7620

Browse files
committed
Change the video source types for audio/webm
1 parent 3094049 commit 43c7620

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

php/media/class-video.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ protected function build_video_embed( $source, $attributes = array(), $overwrite
389389

390390
// If it is an attachment, get the video metadata.
391391
if ( $attachment_id ) {
392+
392393
// Check for transformations.
393394
$transformations = $this->media->get_transformations( $attachment_id, array(), $overwrite_transformations );
394395
if ( ! empty( $transformations ) ) {
@@ -410,6 +411,12 @@ protected function build_video_embed( $source, $attributes = array(), $overwrite
410411
);
411412
$params['source']['transformation'] = array_merge( $streaming_transform, $transformations );
412413
}
414+
415+
$meta = wp_get_attachment_metadata( $attachment_id, true );
416+
417+
if ( ! empty( $meta['mime_type'] ) && 'audio/webm' === $meta['mime_type'] ) {
418+
$params['source']['source_types'] = array( 'audio' );
419+
}
413420
}
414421

415422
$video_defaults = array(

0 commit comments

Comments
 (0)