mirror of
https://github.com/SoPat712/maisie-heardle.git
synced 2025-08-21 18:28:45 -04:00
Wait until full page load
This commit is contained in:
@@ -232,17 +232,23 @@
|
|||||||
countdownInterval = setInterval(updateTime, 1000);
|
countdownInterval = setInterval(updateTime, 1000);
|
||||||
|
|
||||||
widget = SC.Widget(iframeElement);
|
widget = SC.Widget(iframeElement);
|
||||||
widget.bind(SC.Widget.Events.READY, () => {
|
// wait for full page load (or you could just use setTimeout)
|
||||||
widget.getDuration((d: number) => (fullDuration = d));
|
window.addEventListener('load', () => {
|
||||||
widget.getCurrentSound((sound: any) => {
|
widget.bind(SC.Widget.Events.READY, () => {
|
||||||
artworkUrl = sound.artwork_url || '';
|
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, () => {
|
widget.bind(SC.Widget.Events.PLAY, () => {
|
||||||
|
Reference in New Issue
Block a user