Take two, this time it doesn't brooke everything

This commit is contained in:
Marks Polakovs 2020-05-01 10:56:22 +02:00
parent 440fb9db42
commit f87fb483c7

View file

@ -19,6 +19,7 @@ const playerGainTweens: Array<{
tweens: Between[];
}> = [];
const loadAbortControllers: AbortController[] = [];
const lastObjectURLs: string[] = [];
type PlayerStateEnum = "playing" | "paused" | "stopped";
type PlayerRepeatEnum = "none" | "one" | "all";
@ -297,7 +298,11 @@ export const load = (
const playerInstance = await audioEngine.createPlayer(player, objectUrl);
URL.revokeObjectURL(objectUrl);
// Clear the last one out from memory
if (typeof lastObjectURLs[player] === "string") {
URL.revokeObjectURL(lastObjectURLs[player]);
}
lastObjectURLs[player] = objectUrl;
playerInstance.on("loadComplete", (duration) => {
console.log("loadComplete");