Content

Currently, we offer audio pronunciations for our entries in MP3. You can try them out by clicking the 'speaker' icons on an entry on Cambridge Dictionaries Online, and we also offer those sound files through the API. However, the MP3 format is proprietary, and not all browsers support it, notably Firefox and Opera. We want it to be easy for you as developers to use our content and for it to "just work".

Luckily, HTML5 includes a method for specifying alternatives, and we plan to also deliver our files in the more open Ogg Vorbis format. Currently, however, the XML DTD we're using for the XML version only allows us to specify one media type, so we'd like to make a small change to extend it. Here's a breakdown of exactly what will change

On Cambridge Dictionaries Online

For the moment, nothing will change on Cambridge Dictionaries Online; we will continue to provide sound in mp3 with a small 'helper' written in Flash for Firefox and Opera users.

In the HTML5 version

The audio currently looks like this in the HTML5 returned by the server:

<audio>
    <source src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.mp3"/>
</audio>

The only change we will make is to add a new source element, and to make sure the source elements have the correct MIME type specified:

<audio region="us">
    <source type="audio/mpeg" src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.mp3"/>
    <source type="audio/ogg" src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.ogg"/>
</audio>

In the XML version

If you are using the audio element to provide audio pronunciations from the XML, you'll have noticed that it currently looks like this:

<audio region="us" src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.mp3"/>

What we intend to do is to move to the following structure:

<audio region="us">
    <source type="audio/mpeg" src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.mp3"/>
    <source type="audio/ogg" src="http://dictionary.cambridge.org/media/british/us_pron/g/get/get__/get.ogg"/>
</audio>

You'll notice it works just like the HTML5.

Here's the DTD declaration, including the deprecated attributes:

<!-- 
    <audio> is a reference to an audio pronunciation file. 
    The region attribute indicates whether it is a UK or US pronunciation.
    Old style: The file is in the src attribute. 
    New style: The file is in the source element, 
        which has a type attribute indicating if it is 
        - mp3 (audio/mpeg), or 
        - ogg (audio/ogg).
-->
<!ELEMENT audio (source*) >
<!ATTLIST audio 
    region CDATA #IMPLIED
    src CDATA #IMPLIED 
>
<!ELEMENT source >
<!ATTLIST source 
    type CDATA #IMPLIED
    src CDATA #IMPLIED 
>

What do you need to do?

If you're using the HTML5 version, you shouldn't need to do anything. The only change is that users of browsers which don't support mp3 but do support Ogg will suddenly work.

If you're using the XML version and converting the XML to use your own player to provide audio and you want to continue to do this, you can switch when we make the change, or, if you want a watertight conversion plan:

If the audio tag has a src attribute, use that (i.e. your code will continue to work until we make the change).

Otherwise use the src attribute from the source element which refers to an mp3 file - you can find it with

  • ./source[@type="audio/mpeg"] if you're using XPath selectors, or
  • >source[type="audio/mpeg"], if you're using CSS-like selectors, or
  • using your own language's tools to navigate the XML DOM

Contact Us

To request permission to use or license Cambridge dictionary data, please complete our query form.