getMediaState method Null safety

Future<MediaStateResponse> getMediaState(
  1. [Map<String, dynamic>? args]
)

Get the current playing state of a media source. Supports ffmpeg and vlc media sources (as of OBS v25.0.8), Returns a MediaStateResponse object.

Implementation

Future<MediaStateResponse> getMediaState([Map<String, dynamic>? args]) async {
  final response = await command('GetMediaState', args);

  if (response == null) {
    throw Exception('Problem getting media state');
  }

  return MediaStateResponse.fromJson(response.rawResponse);
}