Skip to content
This repository was archived by the owner on Aug 22, 2025. It is now read-only.

Commit aee8ba0

Browse files
Merge pull request #94 from dharmin/legacy-ogg-support
Add legacy support for ogg file format
2 parents f5cd827 + 19e57df commit aee8ba0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

admin/rt-transcoder-handler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,18 +185,18 @@ function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat = true
185185

186186
$type_arry = explode( '.', $url );
187187
$type = strtolower( $type_arry[ count( $type_arry ) - 1 ] );
188+
$extension = pathinfo( $path, PATHINFO_EXTENSION );
188189
$not_allowed_type = array( 'mp3' );
189190
preg_match( '/video|audio/i', $metadata['mime_type'], $type_array );
190191

191-
if ( preg_match( '/video|audio/i', $metadata['mime_type'], $type_array ) && ! in_array( $metadata['mime_type'], array( 'audio/mp3' ), true ) && ! in_array( $type, $not_allowed_type, true ) ) {
192+
if ( ( preg_match( '/video|audio/i', $metadata['mime_type'], $type_array ) || 'application/ogg' === $metadata['mime_type'] ) && ! in_array( $metadata['mime_type'], array( 'audio/mp3' ), true ) && ! in_array( $type, $not_allowed_type, true ) ) {
192193
$options_video_thumb = $this->get_thumbnails_required( $attachment_id );
193194
if ( empty( $options_video_thumb ) ) {
194195
$options_video_thumb = 5;
195196
}
196197

197198
$job_type = 'video';
198-
199-
if ( 'audio' === $type_array[0] ) {
199+
if ( 'audio' === $type_array[0] || in_array( $extension, explode( ',', $this->audio_extensions ), true ) ) {
200200
$job_type = 'audio';
201201
}
202202

0 commit comments

Comments
 (0)