JavaScript
Error handling

by Benny Neugebauer

const url = window.URL.createObjectURL(file);
const video = document.createElement('video');
video.addEventListener('error', (error) => window.URL.revokeObjectURL(url), true);

const url = window.URL.createObjectURL(file);
const video = document.createElement('video');
video.onerror = (error) => window.URL.revokeObjectURL(url);