Skip to content

Instantly share code, notes, and snippets.

@suragch
Created April 23, 2021 11:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suragch/2e6d8e712fce2ddf3fdd4ebfb9991933 to your computer and use it in GitHub Desktop.
Save suragch/2e6d8e712fce2ddf3fdd4ebfb9991933 to your computer and use it in GitHub Desktop.
Steaming audio in Flutter with Just Audio (state)
import 'package:flutter/material.dart';
class PageManager {
final progressNotifier = ValueNotifier<ProgressBarState>(
ProgressBarState(
current: Duration.zero,
buffered: Duration.zero,
total: Duration.zero,
),
);
final buttonNotifier = ValueNotifier<ButtonState>(ButtonState.paused);
}
class ProgressBarState {
ProgressBarState({
required this.current,
required this.buffered,
required this.total,
});
final Duration current;
final Duration buffered;
final Duration total;
}
enum ButtonState {
paused, playing, loading
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment