html5調用手機攝像頭 && 震動

 <input type="file" accept="image/*" capture="camera">
<input type="file" accept="image/gif,image/jpeg" capture="camera"> <input type="file" accept="video/*" capture="camcorder"> <input type="file" accept="audio/*" capture="microphone">
<input type="file" accept="image/*" multiple>(multiple 多選)
<input type="file" multiple>

capture表示,能夠捕獲到系統默認的設備,好比:camera--照相機;camcorder--攝像機;microphone--錄音。
 web

震動瀏覽器

var vibrateSupport = "vibrate" in navigator;
    if (vibrateSupport) { //兼容不一樣的瀏覽器
        document.getElementById('div').innerHTML='yes';
        navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;
        navigator.vibrate([1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500, 1000, 500]);
      //  navigator.vibrate(3000)
    }else{
        document.getElementById('div').innerHTML='no';
    }
相關文章
相關標籤/搜索