user clicks on HTML file input element
<form enctype="multipart/form-data" class='media-upload-form'>
<div class='upload_container'>
<input type="file" name="file"
id="fileUpload{{unbound view.elementId}}"
accept="{{unbound view.accept}}">
</div>
where view.accept = 'video/*' or 'image/*'
we capture click/touch event and if in native app we make a call into forge's native hooks:
_getMedia: function(func, options, success, error) {
forge.file[func](options, function(file) {
if(forge.file.info) {
forge.file.info(file, function(info) {
file.timestamp = moment(info.date).unix();
file.size = info.size;
success(file);
}, error);
} else {
file.timestamp = Math.floor(Breadcrumb.now() / 1000);
file.size = 0;
success(file);
}
}, error);
},
where func = 'getImage' or 'getMedia'
essentially we are using forge.file.getVideo
and forge.file.getImage
(these are links to the documentation)
which return us a javascript file object that we then upload with forge.request.ajax
so what we need is a custom forge module that extends the functionality of forge.file.getVideo
with compression and a forced review