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