パッケージ、リポジトリ、アプリカテゴリを検索

audio_video_progress_bar のカバー
パッケージ詳細v2.0.3

audio_video_progress_bar

オーディオまたはビデオストリームの位置を表示または変更するためのプログレスバー小道具。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
6.5万
いいね数
446
Pub ポイント
150

パッケージをインストール

flutter pub add audio_video_progress_bar

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Flutterウィジェットで、オーディオまたはビデオストリームの再生位置を表示および制御するように設計されています。メディアコンテンツ内をシークするためにインタラクティブなプログレスバーを提供します。カスタマイズ可能で、モバイル、Web、デスクトップなど複数のプラットフォームで動作します。オーディオおよびビデオプレイヤーとシームレスに統合され、再生中にスムーズなユーザー体験を提供します。

用途

  • メディアプレーヤーインターフェース
  • 動画タイムラインナビゲーション
  • オーディオトラックの位置指定
  • インタラクティブメディアコントロール
  • ストリーミングアプリケーションUI
  • ライブ音声/動画再生

主な機能

  • シーク可能なプログレスバー
  • クロスプラットフォーム互換性
  • カスタマイズ可能なスタイル
  • リアルタイム再生フィードバック
  • オーディオとビデオの両方をサポート
  • 応答性のあるタッチインタラクション

適している対象

  • メディアアプリを開発する開発者
  • インタラクティブな進行状況インジケーターが必要なUIデザイナー
  • 正確なメディア制御を必要とするアプリ
  • クロスプラットフォーム音声/動画アプリケーション
  • 教育またはエンターテインメント向けストリーミングプラットフォーム

注意事項

  • メディアプレーヤーとの統合が必要です
  • 再生位置の制御に限定
  • 追加の状態管理が必要になる可能性があります
  • メディア以外の用途には適していません
  • 外部メディア処理ロジックに依存しています

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

audio_video_progress_bar

A progress bar widget to show or change the position of an audio or video stream.

Note: This package does not play audio or video itself. It's just a widget you can use to show the progress of your audio or video player. This widget is easier to connect to a media player than the Flutter Slider widget is. It also supports showing the buffered status for streamed media.

Example

Add the ProgressBar widget to your UI. A static example would look like this:

ProgressBar(
  progress: Duration(milliseconds: 1000),
  buffered: Duration(milliseconds: 2000),
  total: Duration(milliseconds: 5000),
  onSeek: (duration) {
    print('User selected a new time: $duration');
  },
),

However, you would normally wrap it in a builder widget that is updated by an audio or video player. That might look something like this:

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;
}

You can check out the GitHub repo for the full example using the just_audio plugin. There is no requirement to use just_audio or even a StreamBuilder, though. You can use any audio or video player that provides updates about the current play location. Just rebuild the ProgressBar widget with the new Duration states.

You'll probably want to add other buttons like start and pause, but these are not included with this package. They aren't hard to build, though, and you can find an example in the GitHub repo.

Thanks to the just_audio code example for help with the buttons.

Customization

The default colors use the theme's primary color, so changing the theme will also update this widget:

However, you can set your own colors and sizes as well:

ProgressBar(
  progress: progress,
  buffered: buffered,
  total: total,
  progressBarColor: Colors.red,
  baseBarColor: Colors.white.withOpacity(0.24),
  bufferedBarColor: Colors.white.withOpacity(0.24),
  thumbColor: Colors.white,
  barHeight: 3.0,
  thumbRadius: 5.0,
  onSeek: (duration) {
    _player.seek(duration);
  },
);

Which would look like this (if the app has a dark theme):

You can also set the location of the time labels:

ProgressBar(
  ...
  timeLabelLocation: TimeLabelLocation.sides,
);

Now the time labels are displayed on the side:

Notes

If your interested in how this widget was made, check out the article Creating a Flutter widget from scratch.

Please open an issue if you find any bugs.

New feature requests

There are a number of interesting feature requests in the GitHub issues. Unfortunately, with the other projects I have going on, I generally don't get around to implementing very many of them. Your best bet is to copy the source code and implement the feature yourself. On the other hand, if the issue you is important enough to you or your company, I'm open to being hired to add your desired feature to this package or to create a custom solution.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト