<input type="file" accept="image/*" capture="camera"> <input type="file" accept="video/*" capture="camcorder"> <input type="file" accept="audio/*" capture="microphone">
## 在webapp上使用input:file, 指定capture屬性調用默認相機,攝像,錄音功能
在iOS6下開發webapp,使用inputz之file,很有用
capture表示,可以捕獲到系統默認的設備,比如:camera--照相機;camcorder--攝像機;microphone--錄音。
accept表示,直接打開系統文件目錄。
其實html5的input:file標簽還支持一個multiple屬性,表示可以支持多選,如:
<input type="file" accept="image/*" multiple>
加上這個multiple后,capture就沒啥用了,因為multiple是專門yong用來支持多選的。
手機瀏覽器的話大部分都是支持的 (不支持的瀏覽器暫時無法就行兼容處理,只能想其他辦法)
微信中ios內置的瀏覽器是完全支持的
android中必須加上accept最好也加上capture
如果是做跨平台應用,在webView中是不能用的,應該調用插件運用原生去實現。