I am using this code to get my hands on an image that was just "uploaded" into browser using <input type="file"> and sending data to some component that uses it.
fileReady(e) {
let file: File = e[0];
let image = new Image();
let src: string;
image.onload = function () {
src = image.src;
//do something with image
}.bind(this);
src = URL.createObjectURL(file);
image.src = src;
}
This work well for images. Next goal, is to make it work with videos too. There is unfortunately no Video() constructor and HTMLVideoElement also doesn't do the trick. How should I rewrite this code so that it can handle videos?
Blobtype