Removed dependency, attempted fix

This commit is contained in:
Josh Patra
2025-04-20 13:37:21 -04:00
parent 4ea37dc3e2
commit c2f15403dd
2 changed files with 16 additions and 19 deletions

View File

@@ -29,14 +29,13 @@
"prettier-plugin-tailwindcss": "^0.6.11", "prettier-plugin-tailwindcss": "^0.6.11",
"svelte": "^5.0.0", "svelte": "^5.0.0",
"svelte-check": "^4.0.0", "svelte-check": "^4.0.0",
"svelte-hero-icons": "^5.2.0",
"tailwindcss": "^4.0.0", "tailwindcss": "^4.0.0",
"typescript": "^5.0.0", "typescript": "^5.0.0",
"typescript-eslint": "^8.20.0", "typescript-eslint": "^8.20.0",
"vite": "^6.2.5" "vite": "^6.2.5"
}, },
"dependencies": { "dependencies": {
"@tarekraafat/autocomplete.js": "^10.2.9", "moment": "^2.30.1",
"moment": "^2.30.1" "svelte-hero-icons": "^5.2.0"
} }
} }

View File

@@ -232,23 +232,21 @@
countdownInterval = setInterval(updateTime, 1000); countdownInterval = setInterval(updateTime, 1000);
widget = SC.Widget(iframeElement); widget = SC.Widget(iframeElement);
// wait for full page load (or you could just use setTimeout)
window.addEventListener('load', () => {
widget.bind(SC.Widget.Events.READY, () => { widget.bind(SC.Widget.Events.READY, () => {
// grab duration & artwork
widget.getDuration((d: number) => (fullDuration = d)); widget.getDuration((d: number) => (fullDuration = d));
widget.getCurrentSound((sound: any) => { widget.getCurrentSound((sound: any) => {
artworkUrl = sound.artwork_url || ''; artworkUrl = sound.artwork_url || '';
}); });
// give SC widget 2s to settle on Netlify before probing // small delay for Netlify, then probe the player
setTimeout(() => { setTimeout(() => {
widget.play(); widget.play();
widget.pause(); widget.pause();
widget.seekTo(0); widget.seekTo(0);
loading = false; loading = false;
widgetReady = true; widgetReady = true;
}, 2000); }, 1000);
});
}); });
widget.bind(SC.Widget.Events.PLAY, () => { widget.bind(SC.Widget.Events.PLAY, () => {