I'm MasY
I'm MasY

Reputation: 19

Flutter video_player with StreamBuilder

I want to use audio_video_progress_bar for my video_player, it require a stream istead for the "DurationState" in this code:

StreamBuilder<DurationState>(
  stream: _durationState,
  builder: (context, snapshot) {
    final durationState = snapshot.data;
    final progress = durationState?.progress ?? Duration.zero;
    final buffered = durationState?.buffered ?? Duration.zero;
    final total = durationState?.total ?? Duration.zero;
    return ProgressBar(
      progress: progress,
      buffered: buffered,
      total: total,
      onSeek: (duration) {
        _player.seek(duration);
      },
    );
  },
),

...

class DurationState {
  const DurationState({this.progress, this.buffered, this.total});
  final Duration progress;
  final Duration buffered;
  final Duration total;
}

What is the attribute of video_palyer_controller can be a stream?

Upvotes: 1

Views: 280

Answers (0)

Related Questions