diff --git a/src/PluginRTCPeerConnection.swift b/src/PluginRTCPeerConnection.swift index 85925862..b2cf4b4b 100644 --- a/src/PluginRTCPeerConnection.swift +++ b/src/PluginRTCPeerConnection.swift @@ -592,6 +592,9 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate { // Let the plugin store it in its dictionary. pluginMediaStreams[currentPluginMediaStream!.id] = currentPluginMediaStream; + + // Fixes issue #576 + self.eventListenerForAddStream(currentPluginMediaStream!) } return currentPluginMediaStream; @@ -603,8 +606,6 @@ class PluginRTCPeerConnection : NSObject, RTCPeerConnectionDelegate { let pluginMediaStream = getPluginMediaStream(stream: stream); - self.eventListenerForAddStream(pluginMediaStream!) - // Fire the 'addstream' event so the JS will create a new MediaStream. self.eventListener([ "type": "addstream",