https://github.com/web-platform-tests/wpt
Raw File
Tip revision: 7efc1fe4f0c85c8b1fdc98fe5c53af690d2122af authored by Anne van Kesteren on 24 May 2016, 13:07:58 UTC
cleanup support files
Tip revision: 7efc1fe
media.js
//
// Returns the URI of a supported video source based on the user agent
//
function getVideoURI(base)
{
    var extension = '.mp4';

    var videotag = document.createElement("video");

    if ( videotag.canPlayType  &&
         videotag.canPlayType('video/ogg; codecs="theora, vorbis"') )
    {
        extension = '.ogv';
    }

    return base + extension;
}

//
// Returns the URI of a supported audio source based on the user agent
//
function getAudioURI(base)
{
    var extension = '.mp3';

    var audiotag = document.createElement("audio");

    if ( audiotag.canPlayType &&
         audiotag.canPlayType('audio/ogg') )
    {
        extension = '.oga';
    }

    return base + extension;
}
back to top