adds buffering intermediate state

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
2026-04-29 17:09:28 -07:00
co-authored by Copilot
parent 618acc9f38
commit f907a4f3b6
2 changed files with 78 additions and 28 deletions
+14 -3
View File
@@ -58,6 +58,17 @@ class _MainPageState extends State<MainPage> {
StreamingAudioBusinessObject get _audio => widget.audio;
late final WebViewController _webViewController;
String _playbackStatusLabel() {
switch (_audio.playbackStatus) {
case StreamingPlaybackStatus.stopped:
return 'Stopped';
case StreamingPlaybackStatus.buffering:
return 'Buffering...';
case StreamingPlaybackStatus.playing:
return 'Playing';
}
}
@override
void initState() {
super.initState();
@@ -193,17 +204,17 @@ class _MainPageState extends State<MainPage> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: _audio.isPlaying ? null : _play,
onPressed: _audio.isStopped ? _play : null,
child: const Text('▶️'),
),
const SizedBox(width: 12),
ElevatedButton(
onPressed: _audio.isPlaying ? _stop : null,
onPressed: _audio.isStopped ? null : _stop,
child: const Text('⏹️'),
),
const SizedBox(width: 16),
Text(
_audio.isPlaying ? 'Playing' : 'Stopped',
_playbackStatusLabel(),
style: TextStyle(color: themeColors.statusText),
),
],