"use strict";

module.exports = function awaitVideoElementLoad(videoElement) {
	// FIXME: Validation
	return new Promise((resolve, reject) => {
		videoElement.addEventListener("loadeddata", (_event) => {
			resolve();
		});

		videoElement.addEventListener("error", (event) => {
			// FIXME: Check that this actually works as expected
			reject(event.error);
		});
	});
};
