 		rtcMediaStream = self.rtcPeerConnectionFactory.mediaStream(withStreamId: UUID().uuidString)
 
 		if videoRequested == true {
+			// No specific video device requested.
+			if videoDeviceId == nil {
+				NSLog("PluginGetUserMedia#call() | video requested (device not specified)")
+				videoDevice = AVCaptureDevice.DiscoverySession.init(deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera, AVCaptureDevice.DeviceType.builtInDualCamera], mediaType: AVMediaType.video, position: AVCaptureDevice.Position.front).devices[0]
+			}
 			// Video device specified.
 			if videoDeviceId != nil {
 				NSLog("PluginGetUserMedia#call() | video requested (specified device id: '%@')", String(videoDeviceId!))
 				let videoDevices: [AVCaptureDevice] = AVCaptureDevice.DiscoverySession.init(deviceTypes: [AVCaptureDevice.DeviceType.builtInWideAngleCamera, AVCaptureDevice.DeviceType.builtInDualCamera], mediaType: AVMediaType.video, position: AVCaptureDevice.Position.unspecified).devices
 				for device: AVCaptureDevice in videoDevices {
 					if device.uniqueID == videoDeviceId {
-						if device.position == AVCaptureDevice.Position.back {
-							usingFront = false
-							break
-						}
+						videoDevice = device
 					}
 				}
 			}
 
-			NSLog("PluginGetUserMedia#call() | chosen video device usingFront: %@", String(describing: usingFront))
+			if videoDevice == nil {
+				NSLog("PluginGetUserMedia#call() | video requested but no suitable device found")
+				
+				errback("no suitable camera device found")
+				return
+			}
 
+			NSLog("PluginGetUserMedia#call() | chosen video device: %@", String(describing: videoDevice!))
+			
 			if videoMinWidth > 0 {
 				NSLog("PluginGetUserMedia#call() | adding media constraint [minWidth:%@]", String(videoMinWidth))
 				mandatoryConstraints["minWidth"] = String(videoMinWidth)

	) {
		NSLog("PluginGetUserMedia#call()")

		let	audioRequested = constraints.object(forKey: "audio") as? Bool ?? false
		let	videoRequested = constraints.object(forKey: "video") as? Bool ?? false
		let	videoDeviceId = constraints.object(forKey: "videoDeviceId") as? String
		let	audioDeviceId = constraints.object(forKey: "audioDeviceId") as? String
		let	videoMinWidth = constraints.object(forKey: "videoMinWidth") as? Int ?? 0
		let	videoMaxWidth = constraints.object(forKey: "videoMaxWidth") as? Int ?? 640
		let	videoMinHeight = constraints.object(forKey: "videoMinHeight") as? Int ?? 0
		let	videoMaxHeight = constraints.object(forKey: "videoMaxHeight") as? Int ?? 640
		let	videoMinFrameRate = constraints.object(forKey: "videoMinFrameRate") as? Float ?? 0.0
		let	videoMaxFrameRate = constraints.object(forKey: "videoMaxFrameRate") as? Float ?? 25.0

		var rtcMediaStream: RTCMediaStream
		var pluginMediaStream: PluginMediaStream?
		var rtcAudioTrack: RTCAudioTrack?
		var rtcVideoTrack: RTCVideoTrack?
		var usingFront: Bool = true
		var mandatoryConstraints: [String: String] = [:]
		var constraints: RTCMediaConstraints


				optionalConstraints: [:]
			)

			rtcVideoSource = self.rtcPeerConnectionFactory.videoSource()
			
			// If videoSource state is "ended" it means that constraints were not satisfied so
			// invoke the given errback.
			if (rtcVideoSource!.state == RTCSourceState.ended) {
				NSLog("PluginGetUserMedia() | rtcVideoSource.state is 'ended', constraints not satisfied")

				errback("constraints not satisfied")
				return
			}

			rtcVideoTrack = self.rtcPeerConnectionFactory.videoTrack(with: rtcVideoSource!,trackId: UUID().uuidString)
			
			#if !TARGET_IPHONE_SIMULATOR
				rtcVideoCapturer = RTCCameraVideoCapturer(delegate: rtcVideoSource!)

				// TODO use constraints
				let formats: [AVCaptureDevice.Format] = RTCCameraVideoCapturer.supportedFormats(for: videoDevice!);
				
				rtcVideoCapturer?.startCapture(
					with: videoDevice!,
					format: formats[0],
					fps: Int(videoMaxFrameRate)
				)
			#endif

			rtcMediaStream.addVideoTrack(rtcVideoTrack!)
		}
