 	var onSetDescriptionSuccessCallback: (() -> Void)!
 	var onSetDescriptionFailureCallback: ((_ error: Error) -> Void)!
 	var onGetStatsCallback: ((_ array: NSArray) -> Void)!
-		
+
 	var streamIds: [String] = []
+	var pluginMediaStreams: [String : PluginMediaStream]! = [:]
 	var trackIdsToSenders: [String : RTCRtpSender] = [:]
 
 	var isAudioInputSelected: Bool = false

	/**
	 * Methods inherited from RTCPeerConnectionDelegate.
	 */
	
	/** Called when media is received on a new stream from remote peer. */
	func peerConnection(_ peerConnection: RTCPeerConnection, didAdd stream: RTCMediaStream) {
		NSLog("PluginRTCPeerConnection | onaddstream")

		if self.rtcPeerConnection.signalingState == RTCSignalingState.closed {
			return
		}

		for streamId: String in streamIds {
			let pluginMediaStream = pluginMediaStreams[streamId];
			self.eventListenerForRemoveStream(pluginMediaStream!.id)
		}

		streamIds = [];
		pluginMediaStreams = [:];

		self.rtcPeerConnection.close()
	}
