Is it reasonable to ask to add support for .FLAC and .AAC audio type of file with HTML 5 audio player?
Is it scheduled? Does it ask a lot of dev?

the problem i face is that i use mediaelement.js as audio player and i can play flac and aac with it on front end. the problem is that in the backend if i render audio file with the native drupal player audio, the player audio display for mp3, wav and ogg, but dont display for flac and aac. i dont want to use the mediaelement.js in the backend.
screenshot

Comments

OCTOGONE.dev created an issue. See original summary.

OCTOGONE.dev’s picture

Issue summary: View changes
cilefen’s picture

Version: 9.0.x-dev » 9.1.x-dev
OCTOGONE.dev’s picture

Issue summary: View changes
StatusFileSize
new25.15 KB
OCTOGONE.dev’s picture

Issue summary: View changes
nitesh624’s picture

Assigned: Unassigned » nitesh624
nitesh624’s picture

StatusFileSize
new851 bytes
new56.03 KB

screenshot_3136196

@OCTOGONE.dev please check this patch in your system

nitesh624’s picture

Status: Active » Needs review
OCTOGONE.dev’s picture

Thank you for your prompt contribution.

nitvirus’s picture

StatusFileSize
new884 bytes
new644 bytes

I was reviewing the patch , found out there were some extra spaces

+      360 => 'audio/aac' ,
+      112 => 'audio/flac' ,

Attaching patch and interdiff file for this.
Not changing the status of ticket.

----
Nit

nitvirus’s picture

Assigned: nitesh624 » Unassigned
andypost’s picture

Is there a logic behind the way the additions are ordered?

Is there a test to extend?

nitesh624’s picture

@andypost thanks for you reply.
1. this issue was caused due to the mime type of .flac was set to "112 => 'application/x-flac'," so i added another mime type "112 => 'audio/flac' ," which solving the issue , so we need to decide which one to keep? in #7 I kept both mime type.

2. I could not find any test related to mime type. Can yiu help me if you somthing. I looked into it core/modules/file/tests/src/Functional/Formatter/FileAudioFormatterTest.php

phenaproxima’s picture

Component: media system » file system
Issue tags: -media, -audio

It doesn't look like this is specifically related to the media system.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andrew answer’s picture

StatusFileSize
new848 bytes

Correct patch uploaded; this patch fix the spaces and don't add additional unneeded line chemical/x-alchemy.

mfb’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

I don't think there's any reason to add a duplicate key 112 for flac. Just fix the existing entry (112 => 'application/x-flac',).

It seems like a good idea to add a change record as well, just in case someone has custom code around this mimetype?

(Possibly it could even make sense to update the filemime of existing files in the file_managed table, although I don't know if there is any precedent of doing that.)

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

andrew answer’s picture

StatusFileSize
new1015 bytes

Added new patch which deleted existing FLAC record. I also found that OPUS files (*.opus) have same problem like AAC/FLAC. Fixed now.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mfb’s picture

This patch needs a couple little tweaks: It looks like the $defaultMapping['mimetypes'] array is in alphabetical order, so e.g. audio/flac should be moved up to follow audio/basic rather than being at the end of all the audio mimetypes. And the $defaultMapping['extensions'] array seems to be maintained in numerical order, so the 189 entry should be moved up.

andrew answer’s picture

Title: Add support for .FLAC and .AAC audio type of file with HTML 5 audio player » Add support for .FLAC, .OPUS and .AAC audio type of file with HTML 5 audio player
StatusFileSize
new1.15 KB

@mfb patch updated.

mfb’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -Needs change record

This looks good to me. Added a draft change record.

alexpott’s picture

+++ b/core/lib/Drupal/Core/File/MimeType/ExtensionMimeTypeGuesser.php
@@ -210,7 +209,9 @@
+      112 => 'audio/flac',

Why not audio/x-acc and audio/x-flac - this is consistent with \GuzzleHttp\Psr7\MimeType::MIME_TYPES - ah I see looking at https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Containers#flac audio/flac is now the standard. Same with audio/aac.

Nice.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 448519a and pushed to 10.1.x. Thanks!

  • alexpott committed 448519ac on 10.1.x
    Issue #3136196 by Andrew Answer, nitesh624, nitvirus, OCTOGONE.dev, mfb...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.