setPlaybackAllowed method

Future<HMSException?> setPlaybackAllowed(
  1. bool isPlaybackAllowed
)

Implementation

Future<HMSException?> setPlaybackAllowed(bool isPlaybackAllowed) async {
  var result = await PlatformService.invokeMethod(
      PlatformMethod.setPlaybackAllowedForTrack,
      arguments: {
        "is_playback_allowed": isPlaybackAllowed,
        "track_id": trackId,
        "track_kind": HMSTrackKindValue.getValueFromHMSTrackKind(
            HMSTrackKind.kHMSTrackKindAudio)
      });

  if (result == null) {
    this.isPlaybackAllowed = isPlaybackAllowed;
    return null;
  } else {
    return HMSException.fromMap(result["error"]);
  }
}