Skip to content

Commit

Permalink
perf: release resources after 5 min of inactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Feb 8, 2024
1 parent 4d5c41c commit 26224d7
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/base/audio_handler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,14 @@ class NamidaAudioVideoHandler<Q extends Playable> extends BasicAudioHandler<Q> {
@override
FutureOr<void> onPlayingStateChange(bool isPlaying) {
CurrentColor.inst.switchColorPalettes(isPlaying);
if (isPlaying) {
_resourcesDisposeTimer?.cancel();
_resourcesDisposeTimer = null;
} else {
_resourcesDisposeTimer ??= Timer(const Duration(minutes: 5), () {
if (!this.isPlaying) stop();
});
}
}

@override
Expand Down

0 comments on commit 26224d7

Please sign in to comment.