mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2025-09-09 15:38:44 +00:00
please stand by
added "please stand by" gif to loading video player
This commit is contained in:
@@ -848,14 +848,15 @@ class bitvidApp {
|
|||||||
const decodedMagnet = decodeURIComponent(magnetURI);
|
const decodedMagnet = decodeURIComponent(magnetURI);
|
||||||
|
|
||||||
// Prevent re-invoking the exact same magnet link if it's already in use
|
// 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) {
|
if (this.currentMagnetUri === decodedMagnet) {
|
||||||
this.log("Same video requested - already playing");
|
this.log("Same video requested - already playing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.currentMagnetUri = decodedMagnet;
|
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
|
// Show the modal
|
||||||
this.playerModal.style.display = "flex";
|
this.playerModal.style.display = "flex";
|
||||||
this.playerModal.classList.remove("hidden");
|
this.playerModal.classList.remove("hidden");
|
||||||
@@ -941,6 +942,11 @@ class bitvidApp {
|
|||||||
this.log("Starting video stream with:", finalMagnet);
|
this.log("Starting video stream with:", finalMagnet);
|
||||||
await torrentClient.streamVideo(finalMagnet, this.modalVideo);
|
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
|
// Periodically mirror main player stats into the modal
|
||||||
const updateInterval = setInterval(() => {
|
const updateInterval = setInterval(() => {
|
||||||
if (!document.body.contains(this.modalVideo)) {
|
if (!document.body.contains(this.modalVideo)) {
|
||||||
|
Reference in New Issue
Block a user