getState method
@valid since 3.59 @detail api @author wangfeng.1004 @brief 获取播放器状态 @return 播放器当前状态,参看 PlayerState{@link #PlayerState}。 @note 仅在音频实例创建后,调用此方法。
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}');
}
}