getStatus method

PlayerStatus getStatus()

Implementation

PlayerStatus getStatus() {
  if (_engine == ffi.nullptr) {
    return const PlayerStatus(
      positionSeconds: 0,
      durationSeconds: 0,
      isPlaying: false,
      currentIndex: -1,
      playlistCount: 0,
      shuffleEnabled: false,
      loopMode: LoopMode.off,
    );
  }

  final s = _getStatus(_engine);
  return PlayerStatus(
    positionSeconds: s.position_seconds,
    durationSeconds: s.duration_seconds,
    isPlaying: s.is_playing != 0,
    currentIndex: s.current_index,
    playlistCount: s.playlist_count,
    shuffleEnabled: s.shuffle_enabled != 0,
    loopMode: LoopMode.values[s.loop_mode.clamp(0, 2)],
  );
}