diff --git a/src/js/app.js b/src/js/app.js index 6a27f62..7d34789 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -848,14 +848,15 @@ class bitvidApp { const decodedMagnet = decodeURIComponent(magnetURI); // Prevent re-invoking the exact same magnet link if it's already in use - // (Note: We set this.currentMagnetUri = null in hideModal() and popstate logic, - // so that returning here won't block re-loading the same magnet after a back button press.) if (this.currentMagnetUri === decodedMagnet) { this.log("Same video requested - already playing"); return; } this.currentMagnetUri = decodedMagnet; + // Set a looping "please stand by" GIF as a temporary placeholder + this.modalVideo.poster = "assets/gif/please-stand-by.gif"; + // Show the modal this.playerModal.style.display = "flex"; this.playerModal.classList.remove("hidden"); @@ -941,6 +942,11 @@ class bitvidApp { this.log("Starting video stream with:", finalMagnet); await torrentClient.streamVideo(finalMagnet, this.modalVideo); + // Remove the loading GIF once the video can play + this.modalVideo.addEventListener("canplay", () => { + this.modalVideo.removeAttribute("poster"); + }); + // Periodically mirror main player stats into the modal const updateInterval = setInterval(() => { if (!document.body.contains(this.modalVideo)) {