mirror of
https://github.com/remix-bot/fluxer.git
synced 2026-11-24 06:01:44 -05:00
feat(music): add inactivity watchdog warning, out-of-band radio titles
- add inactivity warning event and embed prompt before autoleave in Player & PlayerLifecycleMixin - implement out-of-band ICY/Icecast metadata poller in RadioMetadata to track live radio titles without stream corruption - wire live radio title updates into nowPlaying and announceSong in DisplayMixin and PlaybackMixin
This commit is contained in:
1 parent
e501fc62fb
commit
a99e5bca37
13 files changed
+276
-17
No files matched your search
@@ -348,6 +348,10 @@ class Player extends EventEmitter {
|
||||
}
|
||||
|
||||
logger.inactivity(`[Player] Starting inactivity timer for guild ${this._guildId} (${this._inactivityLimit / 1000}s)`);
|
||||
if (!this._inactivityWarned) {
|
||||
this._inactivityWarned = true;
|
||||
this.emit("inactivityWarning", { timeoutMs: this._inactivityLimit });
|
||||
}
|
||||
this._inactivityTimer = setTimeout(() => {
|
||||
const currentMode = this._get247Mode();
|
||||
if (currentMode === "on") {
|
||||
@@ -370,6 +374,7 @@ class Player extends EventEmitter {
|
||||
/** Clear the inactivity timer if running. */
|
||||
_stopInactivityTimer() {
|
||||
this._pendingInactivityCheck = false;
|
||||
this._inactivityWarned = false;
|
||||
if (this._inactivityTimer) {
|
||||
logger.inactivity(`[Player] Stopping inactivity timer for guild ${this._guildId}`);
|
||||
clearTimeout(this._inactivityTimer);
|
||||
@@ -735,6 +740,8 @@ class Player extends EventEmitter {
|
||||
if (this._stateHeartbeat) { clearInterval(this._stateHeartbeat); this._stateHeartbeat = null; }
|
||||
|
||||
this._clearTrackEndTimer();
|
||||
this._stopRadioTitlePolling?.();
|
||||
this._inactivityWarned = false;
|
||||
this._activeTrackOpt = null;
|
||||
|
||||
try {
|
||||
@@ -1087,6 +1094,7 @@ class Player extends EventEmitter {
|
||||
_bridgeStop() {
|
||||
this._playSessionGen = (this._playSessionGen ?? 0) + 1;
|
||||
this._clearPrefetchTimer?.();
|
||||
this._stopRadioTitlePolling?.();
|
||||
if (this._audioBridge) {
|
||||
try { this._audioBridge.stop(); } catch (_) {}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user