1. 程式人生 > >js校驗瀏覽器是否支援攝像頭及麥克風

js校驗瀏覽器是否支援攝像頭及麥克風

window.onload = function () {
        var shower = document.getElementById('show');
        navigator.getUserMedia = navigator.getUserMedia ||
                          navigator.webkitGetUserMedia ||
                          navigator.mozGetUserMedia ||
                          navigator.msGetUserMedia;

        if
(navigator.getUserMedia){ shower.innerHTML = "支援調取攝像頭麥克風" } else { shower.innerHTML = "抱歉不支援" } }