getState method

Future<PlayerState> getState(
  1. dynamic instance
)

Implementation

Future<$p.PlayerState> getState(dynamic instance) async {
  if (Platform.isAndroid) {
    int res = await ($instance as BasicHelper).invoke<dynamic>(
      method: 'getState',
      args: [instance],
      addGlobalEngine: false,
    );
    final state = $a.PlayerState.values.firstWhere((e) => e.$value == res);
    return $p.t_PlayerState.android_to_code(state);
  } else if (Platform.isIOS) {
    int res = await ($instance as BasicHelper).invoke<dynamic>(
      method: 'getState:',
      args: [instance],
      addGlobalEngine: false,
    );
    final state =
        $i.ByteRTCPlayerState.values.firstWhere((e) => e.$value == res);
    return $p.t_PlayerState.ios_to_code(state);
  } else {
    throw UnsupportedError('Unsupported platform');
  }
}