<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [Mac] canPlayType('audio/mpeg; codecs=&quot;mp3&quot;') returns &quot;maybe&quot; instead of &quot;probably&quot; on AVFoundation"
   href="https://bugs.webkit.org/show_bug.cgi?id=147309">147309</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[Mac] canPlayType('audio/mpeg; codecs=&quot;mp3&quot;') returns &quot;maybe&quot; instead of &quot;probably&quot; on AVFoundation
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>528+ (Nightly build)
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Macintosh
          </td>
        </tr>

        <tr>
          <th>URL</th>
          <td>http://jsbin.com/vubukodepo/edit?js,output
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Mac OS X 10.10
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Media Elements
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sajidanwar94&#64;gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I've reported part of this bug as &lt;rdar://22000718&gt;.

The Objective-C platform media player/source calls [AVFoundation isPlayableExtendedMIMEType:] to determine if a MIME type + codec string is supported. I've peeked inside with a debugger and found that it obtains the list of supported video/audio types and codecs from /System/Library/Frameworks/MediaToolbox.framework/Resources/MediaValidator.plist . Inside this plist is a list of supported &quot;AudioCodecs&quot;, which contains strings like &quot;aac &quot; and &quot;.mp3&quot;. However, &quot;mp3&quot; is nowhere to be found, despite the fact that virtually all examples, tutorials, and specifications online use canPlayType() to check the 'audio/mpeg; codecs=&quot;mp3&quot;' MIME type.

Currently, canPlayType('audio/mpeg; codecs=&quot;mp3&quot;') returns &quot;maybe&quot;, but you can edit the plist and add the &quot;mp3&quot; entry, and then canPlayType will return &quot;probably&quot;, which is expected since AV Foundation can obviously play MP3 audio.

On top of that, as I reported in the radar, there appears to be a bug in the implementation of [AVURLAsset isPlayableExtendedMIMEType:] that returns NO on the &quot;.mp3&quot; codec despite its existence in the plist, meaning even canPlayType('audio/mpeg; codecs=&quot;.mp3&quot;') returns &quot;maybe&quot;.

Should WebKit special-case the &quot;mp3&quot; audio codec to return &quot;probably&quot;? That might not be an elegant solution, but unless Apple adds the &quot;mp3&quot; entry to the &quot;AudioCodecs&quot; section of the plist, the call will always return &quot;maybe&quot; instead of &quot;probably&quot;.

A little more information about the AV Foundation bug can be found at the radar, which I've duplicated on Open Radar: <a href="https://openradar.appspot.com/22000718">https://openradar.appspot.com/22000718</a></pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>