mirror of
https://github.com/SoPat712/maisie-heardle.git
synced 2025-08-21 10:18:45 -04:00
Wait until full page load
This commit is contained in:
@@ -232,17 +232,23 @@
|
||||
countdownInterval = setInterval(updateTime, 1000);
|
||||
|
||||
widget = SC.Widget(iframeElement);
|
||||
widget.bind(SC.Widget.Events.READY, () => {
|
||||
widget.getDuration((d: number) => (fullDuration = d));
|
||||
widget.getCurrentSound((sound: any) => {
|
||||
artworkUrl = sound.artwork_url || '';
|
||||
// wait for full page load (or you could just use setTimeout)
|
||||
window.addEventListener('load', () => {
|
||||
widget.bind(SC.Widget.Events.READY, () => {
|
||||
widget.getDuration((d: number) => (fullDuration = d));
|
||||
widget.getCurrentSound((sound: any) => {
|
||||
artworkUrl = sound.artwork_url || '';
|
||||
});
|
||||
|
||||
// give SC widget 2s to settle on Netlify before probing
|
||||
setTimeout(() => {
|
||||
widget.play();
|
||||
widget.pause();
|
||||
widget.seekTo(0);
|
||||
loading = false;
|
||||
widgetReady = true;
|
||||
}, 2000);
|
||||
});
|
||||
// preload silently:
|
||||
widget.play();
|
||||
widget.pause();
|
||||
widget.seekTo(0);
|
||||
loading = false;
|
||||
widgetReady = true;
|
||||
});
|
||||
|
||||
widget.bind(SC.Widget.Events.PLAY, () => {
|
||||
|
Reference in New Issue
Block a user