getPlayerState static method
Gets the current PlayerState
Throws a PlatformException getting the playerState failed Throws a MissingPluginException if the method is not implemented on the native platforms.
Implementation
static Future<PlayerState?> getPlayerState() async {
try {
var playerStateJson =
await (_channel.invokeMethod<String>(MethodNames.getPlayerState));
if (playerStateJson == null) {
return null;
}
var playerStateMap = jsonDecode(playerStateJson) as Map<String, dynamic>;
var playerState = PlayerState.fromJson(playerStateMap);
return playerState;
} on Exception catch (e) {
_logException(MethodNames.getPlayerState, e);
rethrow;
}
}