Problem/Motivation

.m4a files should use the audio/mp4 MIME type, not audio/mpeg.

The apache httpd mime.types file provides this mapping: https://github.com/apache/httpd/blob/trunk/docs/conf/mime.types

As does debian: https://salsa.debian.org/debian/media-types/-/blob/master/mime.types

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1004985

Steps to reproduce

If a file field uses "Audio" as the field formatter, and an m4a file is uploaded, the resulting audio player doesn't work on iOS (Safari or Chrome) due to this markup:

<audio controls="controls">
  <source src="/uploads/sample1.m4a" type="audio/mpeg">
</audio>

But the audio player works with type="audio/mp4"

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

CommentFileSizeAuthor
m4a-mime-type.patch795 bytesmfb

Comments

mfb created an issue. See original summary.

mfb’s picture

Issue summary: View changes

Adding steps to reproduce

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative, +Needs tests

Could we add a simple test case for this? Not sure if there is one that could be expanded?

danielveza’s picture

Status: Needs work » Needs review

This is a tricky one to decide tests for. We don't have any tests for the ExtensionMimeGuesser that I can see.

We do have a test for the Audio Media source with MediaSourceAudioVideoTest, but .m4a files aren't even part of the default configuration of an audio field.

I'm also not sure how far down the track we want to go with this. Do we add ExtensionMimeGuesser tests adhoc as issues come up? There is 350+ extensions in that list.

Verified that the code is correct, and the links above do suggest to that audio/mp4 is the correct mime for m4a files.

I'd be happy to RTBC this one, but I'll move it to review for other thoughts around tests

mfb’s picture

can add whatever kind of test is helpful, but generally we just fix the mapping bug without a test, see e.g. #3136196: Add support for .FLAC, .OPUS and .AAC audio type of file with HTML 5 audio player

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

Thank you for sharing that. If this is something we don't test won't hold this up.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, m4a-mime-type.patch, failed testing. View results

mfb’s picture

Status: Needs work » Reviewed & tested by the community

Unrelated failure

Status: Reviewed & tested by the community » Needs work

The last submitted patch, m4a-mime-type.patch, failed testing. View results

mfb’s picture

Status: Needs work » Reviewed & tested by the community

Yet another unrelated failure

Status: Reviewed & tested by the community » Needs work

The last submitted patch, m4a-mime-type.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community

Random failure.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, m4a-mime-type.patch, failed testing. View results

smustgrave’s picture

Status: Needs work » Reviewed & tested by the community
larowlan’s picture

Version: 10.1.x-dev » 9.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed to 10.1.x and backported to 10.0.x and 9.5.x

Thanks folks!

  • larowlan committed 5d6bf4a7 on 10.0.x
    Issue #3338224 by mfb: .m4a files should use audio/mp4 MIME type, not...

  • larowlan committed 2d38f1ec on 10.1.x
    Issue #3338224 by mfb: .m4a files should use audio/mp4 MIME type, not...

  • larowlan committed ccc13ec8 on 9.5.x
    Issue #3338224 by mfb: .m4a files should use audio/mp4 MIME type, not...

Status: Fixed » Closed (fixed)

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