getState method

Future<PlayerState?> getState()

@detail api @brief Get the state of the media player. @return The current state of the media player. See PlayerState{@link #PlayerState}. @note You can call this method after the creating a IMediaPlayer instance.

Implementation

Future<PlayerState?> getState() async {
  $a() async {
    final funcResult = await ($instance as $p_a.IMediaPlayer).getState();
    if (funcResult == null) {
      throw StateError('Android getState() cannot be null');
    }
    return t_PlayerState.android_to_code(funcResult);
  }

  ;
  $i() async {
    final funcResult =
        await ($instance as $p_i.ByteRTCMediaPlayer).getState();
    if (funcResult == null) {
      throw StateError('iOS getState() cannot be null');
    }
    return t_PlayerState.ios_to_code(funcResult);
  }

  ;

  if (Platform.isAndroid) {
    return $a();
  } else if (Platform.isIOS) {
    return $i();
  } else {
    throw UnsupportedError(
        'Not Support Platform ${Platform.operatingSystem}');
  }
}