diff --git a/openvidu-browser/src/OpenVidu/Stream.ts b/openvidu-browser/src/OpenVidu/Stream.ts index 506347cd..730e5ec8 100644 --- a/openvidu-browser/src/OpenVidu/Stream.ts +++ b/openvidu-browser/src/OpenVidu/Stream.ts @@ -457,8 +457,10 @@ export class Stream implements EventDispatcher { typeof MediaStreamTrack !== 'undefined' && this.outboundStreamOpts.publisherProperties.videoSource instanceof MediaStreamTrack; this.webRtcPeer.dispose(isSenderAndCustomTrack); } - if (!!this.speechEvent && !!this.speechEvent.stop) { - this.speechEvent.stop(); + if (!!this.speechEvent) { + if (!!this.speechEvent.stop) { + this.speechEvent.stop(); + } delete this.speechEvent; }