mediasfu-reactnative
Version:
MediaSFU Prebuilt React Native SDK
30 lines • 1.49 kB
JavaScript
/**
* Checks if the recording can be resumed based on the media type and pause limits.
*
* @param {Object} options - The options for checking resume state.
* @param {string} options.recordingMediaOptions - The type of media being recorded ("video" or "audio").
* @param {number} options.recordingVideoPausesLimit - The maximum number of pauses allowed for video recording.
* @param {number} options.recordingAudioPausesLimit - The maximum number of pauses allowed for audio recording.
* @param {number} options.pauseRecordCount - The current number of pauses that have occurred.
* @returns {Promise<boolean>} - A promise that resolves to a boolean indicating whether the recording can be resumed.
*
* @example
* ```typescript
* const canResume = await checkResumeState({
* recordingMediaOptions: "video",
* recordingVideoPausesLimit: 3,
* recordingAudioPausesLimit: 5,
* pauseRecordCount: 2,
* });
* console.log(canResume); // true if pauseRecordCount is within limits
* ```
*/
export const checkResumeState = async ({ recordingMediaOptions, recordingVideoPausesLimit, recordingAudioPausesLimit, pauseRecordCount, }) => {
// Determine the reference limit for pauses based on the media type
const ref_limit = recordingMediaOptions === 'video'
? recordingVideoPausesLimit
: recordingAudioPausesLimit;
// Check if the user can resume the recording
return pauseRecordCount <= ref_limit;
};
//# sourceMappingURL=checkResumeState.js.map