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

 

posted @ 2017-06-27 19:31  miniFour  阅读(1903)  评论(0编辑  收藏  举报