From 4a8c854570c58ba4d49c6748ceb0804c13504831 Mon Sep 17 00:00:00 2001 From: Jeff Swartz Date: Mon, 30 Sep 2024 11:11:05 -0700 Subject: [PATCH] Fix error when no OTPublisher streamDestroyed handler is set (#779) --- CHANGELOG.md | 2 ++ src/OTPublisher.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6d8f4e3..7b7fd872 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - [Fix]: Updates react, react-native modules (and axios dependency), and replaces uuid with react-native-uuid. The fixes issue #769. And it prevents [an issue](https://github.com/uuidjs/uuid/issues/375) that would result from using an upgraded version of uuid. +- [Fix]: Fixes an error that resulted if you set an OTPublisher event handler for `streamCreated` without setting one for `streamDestroyed`. + # 2.28.1 (September 2024) - [Update]: The new `OTPublisher.setAudioTransformers()` method lets you set (and clear) audio transformers. One transformer, the noise suppression filter, is supported. To use this, call the `setAudioTransformers()` method of the OTPublisher ref, and pass in an array with one object that has a `name` property set to `'NoiseSuppression'` and a `properties` property set to an empty string: diff --git a/src/OTPublisher.js b/src/OTPublisher.js index 358cfa18..f26dd5a2 100644 --- a/src/OTPublisher.js +++ b/src/OTPublisher.js @@ -182,7 +182,7 @@ class OTPublisher extends Component { publisherStreamDestroyedHandler = (stream) => { if ( this.props.eventHandlers - && this.props.eventHandlers.streamCreated + && this.props.eventHandlers.streamDestroyed && stream.publisherId === this.state.publisherId ) { this.props.eventHandlers.streamDestroyed(stream);