0

This is macOS / Safari.

I can play this file by opening in Safari: https://learnwithecho.com/assets/test.m4a

But if I save that file locally:

wget https://learnwithecho.com/assets/test.m4a

And spin up a web server:

php -S 0.0.0.0:8888

And load the same file locally:

open http://localhost:8888/test.m4a

Then I get this error:

Failed to load resource: Plug-in handled load

How can I serve this file locally so it properly plays in Safari?


Here is mediainfo for the file:

General
Complete name                            : assets/test.m4a
Format                                   : MPEG-4
Format profile                           : Apple audio with iTunes info
Codec ID                                 : M4A  (isom/iso2)
File size                                : 26.3 KiB
Duration                                 : 2 s 24 ms
Overall bit rate mode                    : Constant
Overall bit rate                         : 106 kb/s
Writing application                      : Lavf55.33.100

Audio
ID                                       : 1
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 s 24 ms
Duration_LastFrame                       : -20 ms
Bit rate mode                            : Constant
Bit rate                                 : 102 kb/s
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 25.2 KiB (96%)
Default                                  : Yes
Alternate group                          : 1
William Entriken
  • 37,208
  • 23
  • 149
  • 195

1 Answers1

0

Okay, this is the dumbest thing I found out.

macOS / Safari (at least version 13.0.3) does not support playing media resources on localhost using RELATIVE URLs.

The same media WILL play if you use an ABSOLUTE URL like http://localhost...

This is undocumented Safari behavior.

William Entriken
  • 37,208
  • 23
  • 149
  • 195