h5页面上传图片安卓手机无法调用摄像头

<input type="file">

在ios中,会

而安卓中,没有这些选项

解决方法:

给input 加上accept属性

<input type="file" accept="image/*" /> //调用相机 ,图片或者相册 (两者都行)

加上了capture=camera"属性之后安卓手机就直接调用了相机,没有了图库的选项

<input type="file" accept="image/*;capture=camera"> //直接调用相机

<input type="file" accept="video/*;capture=camcorder"> // 调取视频

<input type="file" accept="audio/*;capture=microphone"> //调取音频

注:capture表示,可以捕获到系统默认的设备,比如:camera--照相机;camcorder--摄像机;microphone--录音。

相关推荐
whysqwhw5 分钟前
OkHttp深度架构缺陷分析与演进规划
android
用户7093722538517 分钟前
Android14 SystemUI NotificationShadeWindowView 加载显示过程
android
木叶丸42 分钟前
跨平台方案该如何选择?
android·前端·ios
顾林海1 小时前
Android ClassLoader加载机制详解
android·面试·源码
用户2018792831671 小时前
🎨 童话:Android画布王国的奇妙冒险
android
whysqwhw2 小时前
OkHttp框架的全面深入架构分析
android
你过来啊你2 小时前
Android App冷启动流程详解
android
泓博3 小时前
KMP(Kotlin Multiplatform)改造(Android/iOS)老项目
android·ios·kotlin
移动开发者1号3 小时前
使用Baseline Profile提升Android应用启动速度的终极指南
android·kotlin
移动开发者1号3 小时前
解析 Android Doze 模式与唤醒对齐
android·kotlin