mirror of https://github.com/vector-im/riot-web
Merge pull request #2196 from matrix-org/revert-2176-hs/object-urls-video
Revert "Use createObjectURL instead of readAsDataURL for videos"pull/21833/head
commit
1ceefd3d1b
|
@ -153,17 +153,24 @@ function loadVideoElement(videoFile) {
|
||||||
// Load the file into an html element
|
// Load the file into an html element
|
||||||
const video = document.createElement("video");
|
const video = document.createElement("video");
|
||||||
|
|
||||||
// Wait until we have enough data to thumbnail the first frame.
|
const reader = new FileReader();
|
||||||
video.onloadeddata = function() {
|
reader.onload = function(e) {
|
||||||
URL.revokeObjectURL(video.src);
|
video.src = e.target.result;
|
||||||
deferred.resolve(video);
|
|
||||||
|
// Once ready, returns its size
|
||||||
|
// Wait until we have enough data to thumbnail the first frame.
|
||||||
|
video.onloadeddata = function() {
|
||||||
|
deferred.resolve(video);
|
||||||
|
};
|
||||||
|
video.onerror = function(e) {
|
||||||
|
deferred.reject(e);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
video.onerror = function(e) {
|
reader.onerror = function(e) {
|
||||||
deferred.reject(e);
|
deferred.reject(e);
|
||||||
};
|
};
|
||||||
|
reader.readAsDataURL(videoFile);
|
||||||
// We don't use readAsDataURL because massive files and b64 don't mix.
|
|
||||||
video.src = URL.createObjectURL(videoFile);
|
|
||||||
return deferred.promise;
|
return deferred.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue