UNPKG

mediasfu-reactnative-expo

Version:

mediasfu-reactnative-expo – Expo-managed React Native WebRTC SDK for video conferencing, webinars, live streaming, broadcast, screen sharing, whiteboard, chat, recording, live subtitles, translation, and AI agent rooms on iOS, Android, and web. Prebuilt r

45 lines 2.06 kB
import { producerClosed as sharedProducerClosed } from 'mediasfu-shared'; /** * Handles the closure of a producer identified by its remote producer ID. * This function will clean up the consumer transports and resize the video outputs. * * @function * @async * @param {ProducerClosedOptions} options - The options for closing the producer. * @param {string} options.remoteProducerId - The ID of the remote producer to close. * @param {ProducerClosedParameters} options.parameters - Additional parameters for the operation. * @param {Transport[]} options.parameters.consumerTransports - The list of consumer transports associated with the producer. * @param {Function} options.parameters.closeAndResize - Function to handle the closing and resizing of video streams. * @param {string} [options.parameters.screenId] - The ID of the screen producer (if applicable). * @param {Function} options.parameters.updateConsumerTransports - Function to update the state of consumer transports. * @returns {Promise<void>} A promise that resolves when the producer has been successfully closed. * @throws Will throw an error if there is an issue closing the consumer transport or the producer. * * @example * import { producerClosed } from 'mediasfu-reactnative-expo'; * * const options = { * remoteProducerId: 'producerId', * parameters: { * consumerTransports: [], // Array of consumer transports * closeAndResize: (params) => console.log('Close and resize called', params), * screenId: 'screenId', * updateConsumerTransports: (transports) => console.log('Updated transports:', transports), * }, * }; * * producerClosed(options) * .then(() => { * console.log('Producer closed successfully'); * }) * .catch((error) => { * console.error('Error closing producer:', error); * }); */ export const producerClosed = async ({ remoteProducerId, parameters, }) => { return sharedProducerClosed({ remoteProducerId, parameters: parameters, }); }; //# sourceMappingURL=producerClosed.js.map