苹果手机怎么当摄像头,html5怎么调用手机摄像头并且扫描二维码
答案:1 悬赏:20 手机版
解决时间 2021-05-19 19:02
- 提问者网友:愿为果
- 2021-05-18 23:50
苹果手机怎么当摄像头,html5怎么调用手机摄像头并且扫描二维码
最佳答案
- 五星知识达人网友:过活
- 2021-05-19 00:53
需要加载cordova.js 方法: document.addEventListener(deviceready, onDeviceReady, false); function onDeviceReady() { pictureSource = navigator.camera.PictureSourceType; destinationType = navigator.camera.DestinationType; } //相册 function fromCamera() { var source = pictureSource.PHOTOLIBRARY; navigator.camera.getPicture(function (imageData) { setimg(imageData); }, function (message) { if (source == pictureSource.CAMERA) alert('加载照相机出错!' + message); else alert('加载相册出错!' + message); }, { quality: 50, destinationType: destinationType.FILE_URI, sourceType: source }); } //拍照 function EditImgPz() { navigator.camera.getPicture(function (imageData) { setimg(imageData); }, function (message) { alert(message); }, { quality: 50, destinationType: navigator.camera.DestinationType.FILE_URI, sourceType: Camera.PictureSourceType.CAMERA, allowEdit: true, encodingType: Camera.EncodingType.JPEG, popoverOptions: CameraPopoverOptions, saveToPhotoAlbum: true }); }
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯