Skip to main content Link Menu Expand (external link) Document Search Copy Copied
getPlayerState method - FlutterSoundPlayer class - player library - Dart API
menu
getPlayerState

getPlayerState method

Future<PlayerState> getPlayerState()

Query the current state of the Flutter Sound Core layer.


Most of the time, the App will not use this verb, but will use the playerState variable. This is seldom used when the App wants to get an updated value of the background state.

See also


Implementation

Future<PlayerState> getPlayerState() async {
  await _waitOpen();
  if (_isInited != Initialized.fullyInitialized) {
    throw Exception('Player is not open');
  }
  var state = await FlutterSoundPlayerPlatform.instance.getPlayerState(this);
  _playerState = PlayerState.values[state];
  return _playerState;
}
flutter_sound 9.25.3