0

I am trying to connect my webcam from my cell phone through xamarin, however, it is not working, when using my front camera and my back camera it works, however when I use CameraOptions = "External" it does not detect the webcam This is my code with which I create the camera view:

<xct:CameraView
                    Grid.Column="0"
                    x:Name="cameraView"
                    CaptureMode="Photo"
                    CameraOptions="External"
                    FlashMode="Off"
                    HorizontalOptions="FillAndExpand"
                    MediaCaptured="CameraView_MediaCaptured"
                    OnAvailable="CameraView_OnAvailable"
                    VerticalOptions="FillAndExpand" />

In my main activity I defined this intent filter and this meta data for the detection of usb devices:

[IntentFilter(new[] { Android.Hardware.Usb.UsbManager.ActionUsbDeviceAttached })]
    [MetaData(name: "Android.Hardware.Usb.UsbManager.ActionUsbDeviceAttached", Resource = "@xml/device_filter")]

In the application path Android \ Resources I defined a folder called xml where I created a file called device_filter.xml to be able to define the properties of my camera

<?xml version="1.0" encoding="utf-8" ?>
<resources>
  <usb-device vendor-id="2431" product-id="4653" class="33" subclass="33" protocol="1"/>
</resources>

Also in the BuildAction property of device_filter.xml I defined as parameter AndroidResource And request the camera permissions and record audio:

<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />

What could I do to make it detect my webcam?

0 Answers0