This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validFile(file, success, error) { | |
const MAX_VIDEO_SIZE = 1024 * 1024 * 100; | |
const MAX_VIDEO_DURATION = 30; | |
const SIZE_ERROR = 1; | |
const DURATION_ERROR = 2; | |
if (file.size() > MAX_VIDEO_SIZE) { | |
error(SIZE_ERROR); | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_onFileChanged(e) { | |
let f = new FormData(); | |
// TODO set the attribute name | |
f.append('video[video]', e.target.files[0]); | |
var xhr = new XMLHttpRequest(); | |
xhr.addEventListener("load", () => { | |
xhr.complete = true; | |
// TODO Next action |