【问题标题】:Why HTML `<input type="file" />` accept property `audio/mpeg` and `audio/mp3` works the same if I just want to select MP3?如果我只想选择 MP3,为什么 HTML `<input type="file" />` 接受属性 `audio/mpeg` 和 `audio/mp3` 工作方式相同?
【发布时间】:2020-05-12 04:20:18
【问题描述】:

请看这两个最小的例子

音频/mpeg

&lt;input type="file" accept="audio/mpeg"&gt;

音频/mp3

&lt;input type="file" accept="audio/mp3"&gt;

两个例子都可以选择唯一的 MP3,为什么会这样?

如果我想强制我的用户只选择一个 MP3 文件,我应该使用哪个代码 sn-p?

哪个是最好的?

【问题讨论】:

    标签: javascript html audio


    【解决方案1】:

    MP3 只是 MPEG 文件的音频部分,因此指定 audio/mpeg 等同于指定 audio/mp3

    有关媒体格式的更多信息可以找到in this article on MDN.

    【讨论】:

      猜你喜欢
      • 2011-06-22
      • 1970-01-01
      • 1970-01-01
      • 2011-11-15
      • 2013-05-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-21
      相关资源
      最近更新 更多