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--錄音。
 

震動

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';
    }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM