Weird boot sound effects

This commit is contained in:
2025-03-27 00:22:41 +08:00
parent 38e1c51b45
commit 4589722c3b
7 changed files with 41 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import 'dart:developer';
import 'dart:io';
import 'dart:ui';
import 'package:audioplayers/audioplayers.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:croppy/croppy.dart';
import 'package:dio/dio.dart';
@ -345,6 +346,7 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener {
final ct = context.read<ChatChannelProvider>();
await ct.refreshAvailableChannels();
_setPhaseText('done');
_playIntro();
}
} catch (err) {
if (!mounted) return;
@ -361,6 +363,17 @@ class _AppSplashScreenState extends State<_AppSplashScreen> with TrayListener {
// The quit key has been removed, and the logic of the quit key is moved to system menu bar activator.
}
void _playIntro() async {
final cfg = context.read<ConfigProvider>();
if (!cfg.soundEffects) return;
final player = AudioPlayer(playerId: 'launch-intro-player');
await player.play(AssetSource('audio/sfx/launch-intro.mp3'), volume: 0.5);
player.onPlayerComplete.listen((_) {
player.dispose();
});
}
final Menu _appTrayMenu = Menu(
items: [
MenuItem(key: 'version_label', label: 'Solian', disabled: true),