gg_time_controller 1.0.4 copy "gg_time_controller: ^1.0.4" to clipboard
gg_time_controller: ^1.0.4 copied to clipboard

A time controller for media players with play, pause, stop, jumpTo and animateTo methods.

A time controller for media players with play, pause, stop, jumpTo and animateTo methods.

Features #

In media player apps like video players, time control is needed. We need to be able to play, stop, forward, and backward time. Exactly this is realized with GgTimeController.

  • Delivers time stamps on a frame basis
  • start, stop, pause delivering time stamps.
  • Animate or jump to a given time using animateTo and jumpTo

Example #

// Create a callback listening to time stamps
final timeController = GgTimeController(onTimeStamp: (timeStamp){
  print('time: ${timeStamp.time.inMilliseconds}')
});

// Listen to state
timeController.state.listen((state){
  print(state);
});

/// Start playing
timeController.play();

/// Wait for five frames
await Future<void>.delayed(GgTimeController.defaultFrameDuration * 5);

/// Pause playing
timeController.play();

/// Jump to 10s
timeController.jumpTo(time: const Duration(seconds: 10));

/// Animate to 20s
timeController.animateTo(time: const Duration(seconds: 10));

// Stop
timeController.stop();

Getting started #

Look into the example to see how GgTimeController works.

Features and bugs #

Please file feature requests and bugs at GitHub.

1
likes
140
pub points
31%
popularity

Publisher

verified publisherinlavigo.com

A time controller for media players with play, pause, stop, jumpTo and animateTo methods.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

fake_async, gg_periodic_timer, gg_typedefs, gg_value, meta

More

Packages that depend on gg_time_controller