Search code examples
htmlaudiosafariogg

safari doesn't play .ogg files, so how does it work on wiktionary.org?


Safari does not support .ogg files, but that does not stop wiktionary.org from playing ogg files. I have looked through the source there and I cannot find how they are playing the files.

Here is the link where they are using an .ogg file. https://en.wiktionary.org/wiki/File:en-us-the-unstressed.ogg


Solution

  • When you take a look at the XHRs of the site, you'll notice, that they actually load the EN-us-the-unstressed.ogg file along with these two scripts:

    ogv-worker-audio.js
    ogv-decoder-audio-vorbis.js
    

    The scripts are part of the ogv.js JavaScript library:

    JavaScript media player using Ogg/Vorbis/Theora/Opus/WebM libs compiled with Emscripten

    The library does basically this:

    Long-form goal is to create a drop-in replacement for the HTML5 video and audio tags which can be used for basic playback of Ogg Theora and Vorbis or WebM media on browsers that don't support Ogg or WebM natively.

    So instead of using native audio|video-elements, they use JavaScript to playback audio, that is imported from .ogg-files.