startPlayer method

Future<void> startPlayer (
  1. {String path}
)

Start current play audio

Implementation

Future<void> startPlayer({String path}) async {
  assert(path != null);

  if (isPlaying) return stopPlayer();

  isPlaying = true;

  try {
    // if (_timer != null) {
    //   _timer.cancel();
    //   _timer = null;
    // }
    // _timer = _getCurrentTimeTimer(DateTime.now().millisecondsSinceEpoch,
    //     (int currentTime) {
    //   _playListener(DateTime.now().millisecondsSinceEpoch - currentTime);
    // });
    await _channel.invokeMethod('startPlayer', {'path': path});
  } catch (e) {
    print(e);
  }
}