diff --git a/packages/hmssdk_flutter/lib/src/enum/hms_recording_state.dart b/packages/hmssdk_flutter/lib/src/enum/hms_recording_state.dart new file mode 100644 index 000000000..da610dfdf --- /dev/null +++ b/packages/hmssdk_flutter/lib/src/enum/hms_recording_state.dart @@ -0,0 +1,63 @@ +enum HMSRecordingState { + none, + + starting, + + started, + + paused, + + resumed, + + stopped, + + failed, +} + +extension HMSRecordingStateValues on HMSRecordingState { + static HMSRecordingState getRecordingStateFromName(String name) { + switch (name) { + case 'NONE': + return HMSRecordingState.none; + case 'STARTING': + return HMSRecordingState.starting; + case 'STARTED': + return HMSRecordingState.started; + case 'PAUSED': + return HMSRecordingState.paused; + case 'RESUMED': + return HMSRecordingState.resumed; + case 'STOPPED': + return HMSRecordingState.stopped; + case 'FAILED': + return HMSRecordingState.failed; + default: + return HMSRecordingState.none; + } + } + + static String getNameFromRecordingState(HMSRecordingState state) { + switch (state) { + case HMSRecordingState.none: + return 'NONE'; + + case HMSRecordingState.starting: + return 'STARTING'; + + case HMSRecordingState.started: + return 'STARTED'; + + case HMSRecordingState.paused: + return 'PAUSED'; + + case HMSRecordingState.resumed: + return 'RESUMED'; + + case HMSRecordingState.stopped: + return 'STOPPED'; + + case HMSRecordingState.failed: + return 'FAILED'; + } + } +} diff --git a/packages/hmssdk_flutter/lib/src/enum/hms_streaming_state.dart b/packages/hmssdk_flutter/lib/src/enum/hms_streaming_state.dart new file mode 100644 index 000000000..c8c849756 --- /dev/null +++ b/packages/hmssdk_flutter/lib/src/enum/hms_streaming_state.dart @@ -0,0 +1,49 @@ +enum HMSStreamingState { + none, + + starting, + + started, + + stopped, + + failed, +} + +extension HMSStreamingStateValues on HMSStreamingState { + static HMSStreamingState getStreamingStateFromName(String name) { + switch (name) { + case 'NONE': + return HMSStreamingState.none; + case 'STARTING': + return HMSStreamingState.starting; + case 'STARTED': + return HMSStreamingState.started; + case 'STOPPED': + return HMSStreamingState.stopped; + case 'FAILED': + return HMSStreamingState.failed; + default: + return HMSStreamingState.none; + } + } + + static String getNameFromStreamingState(HMSStreamingState state) { + switch (state) { + case HMSStreamingState.none: + return 'NONE'; + + case HMSStreamingState.starting: + return 'STARTING'; + + case HMSStreamingState.started: + return 'STARTED'; + + case HMSStreamingState.stopped: + return 'STOPPED'; + + case HMSStreamingState.failed: + return 'FAILED'; + } + } +}