webUploader在安卓手机直接调取相机

1、在源码里面加上input.attr('capture', 'camera');可以直接调用安卓手机的拍照功能

 return Html5Runtime.register('FilePicker', {
            init: function () {
                var container = this.getRuntime().getContainer(),
                    me = this,
                    owner = me.owner,
                    opts = me.options,
                    label = this.label = $(document.createElement('label')),
                    input = this.input = $(document.createElement('input')),
                    arr, i, len, mouseHandler;

                input.attr('type', 'file');
                input.attr('name', opts.name);

                //安卓机可以直接调用拍照功能
                if (navigator.userAgent.indexOf('Android') > -1 || navigator.userAgent.indexOf('Linux') > -1) {
                    input.attr('capture', 'camera');
                }

                input.addClass('webuploader-element-invisible');

                label.on('click', function () {
                    input.trigger('click');
                });

                label.css({
                    opacity: 0,
                    width: '100%',
                    height: '100%',
                    display: 'block',
                    cursor: 'pointer',
                    background: '#ffffff'
                });

你可能感兴趣的:(webUploader在安卓手机直接调取相机)