Skip to content

Black Screen Issue when Displaying Multiple UVC Cameras Simultaneously #18

@kchanyou

Description

@kchanyou

Hello. I'm experiencing difficulties getting two UVC cameras to display simultaneously in Unity. Currently, one camera displays correctly, while the other shows only a black screen( = If I turn off one of the two cameras, the other one displays normally )

Problem:

  • I'm trying to connect two UVC cameras in Unity and display each on separate RawImage components.
  • The first camera displays correctly, but the second camera only shows a black screen.
  • The CameraInfo objects are created correctly for both cameras, and the previewTexture property has the correct size and format.
  • Adding delays to allow enough time for the texture to be ready has not resolved the issue.

Question

  1. Does the native plugin support multiple UVC cameras simultaneously?
    (It seems like the ReadMe says it's supported.)
  2. Are there any additional settings or code required to display multiple UVC cameras at the same time?

Environment:
Unity version: 2021.3.25f1
Plugin version: r0.2.0
Android version: 13

Logcat

3210 3351 Info Unity [QUVC]OnDeviceChanged#CameraID : 477407871
3210 3351 Info Unity [QUVC]OnDeviceChanged#device: Serenegiant.UVC.UVCDevice(id=477407871,vid=3141,pid=25446,name=/dev/bus/usb/002/003,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3351 Info Unity [QUVC]HandleOnAttachEvent#device : Serenegiant.UVC.UVCDevice(id=477407871,vid=3141,pid=25446,name=/dev/bus/usb/002/003,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3351 Info Unity [QUVC] OnDeviceChanged: Mapping camera ID 477407871 to UVCDrawer
3210 3351 Info Unity [QUVC] OnDeviceChanged: attachedDevices.Count : 0
3210 3351 Info Unity [QUVC] PERMISSION IN
3210 3351 Info Unity [QUVC] Camera permission already granted for device: 477407871
3210 3351 Info Unity ---------[QUVC]StartPreview
3210 3240 Info Unity [QUVC] previewTexture: (UnityEngine.Texture2D), width: 1280, height: 720, format: RGBA32
3210 3240 Info Unity [QUVC] StartPreview#nativeTexPtr : 29
3210 3240 Info Unity [QUVC] StartPreview#deviceId : 477407871
3210 3240 Info Unity --------[QUVC] OnPreviewTextureReady: device: 477407871
3210 3240 Info Unity [QUVC]device: 477407871
3210 3240 Info Unity --------[QUVC]HandleOnStartPreviewEvent#info : Serenegiant.UVC.UVCManager+CameraInfo(1280x720,id=477407871,activeId=477407871,IsPreviewing=True)
3210 3240 Info Unity [QUVC]info.deviceSerenegiant.UVC.UVCDevice(id=477407871,vid=3141,pid=25446,name=/dev/bus/usb/002/003,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3240 Info Unity [QUVC]previewTexture (UnityEngine.Texture2D)
3210 3240 Info Unity [QUVC] OnUVCStartEvent: Device ID = 477407871, Texture = (UnityEngine.Texture2D)
3210 3240 Info Unity [QUVC] Drawing on RawImage for Camera ID: 477407871, RawImage Name: RawImage_L
3210 3351 Info Unity [QUVC]OnDeviceChanged#CameraID : -215317999
3210 3351 Info Unity [QUVC]OnDeviceChanged#device: Serenegiant.UVC.UVCDevice(id=-215317999,vid=3141,pid=25446,name=/dev/bus/usb/002/006,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3351 Info Unity [QUVC]HandleOnAttachEvent#device : Serenegiant.UVC.UVCDevice(id=-215317999,vid=3141,pid=25446,name=/dev/bus/usb/002/006,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3351 Info Unity [QUVC] OnDeviceChanged: Mapping camera ID -215317999 to UVCDrawer
3210 3351 Info Unity [QUVC] OnDeviceChanged: attachedDevices.Count : 1
3210 3351 Info Unity [QUVC] PERMISSION IN
3210 3351 Info Unity [QUVC] Camera permission already granted for device: -215317999
3210 3351 Info Unity ---------[QUVC]StartPreview
3210 3240 Info Unity [QUVC] previewTexture: (UnityEngine.Texture2D), width: 1280, height: 720, format: RGBA32
3210 3240 Info Unity [QUVC] StartPreview#nativeTexPtr : 30
3210 3240 Info Unity [QUVC] StartPreview#deviceId : -215317999
3210 3240 Info Unity --------[QUVC] OnPreviewTextureReady: device: -215317999
3210 3240 Info Unity [QUVC]device: -215317999
3210 3240 Info Unity --------[QUVC]HandleOnStartPreviewEvent#info : Serenegiant.UVC.UVCManager+CameraInfo(1280x720,id=-215317999,activeId=-215317999,IsPreviewing=True)
3210 3240 Info Unity [QUVC]info.deviceSerenegiant.UVC.UVCDevice(id=-215317999,vid=3141,pid=25446,name=/dev/bus/usb/002/006,deviceClass=239,deviceSubClass=2,deviceProtocol=1)
3210 3240 Info Unity [QUVC]previewTexture (UnityEngine.Texture2D)
3210 3240 Info Unity [QUVC] OnUVCStartEvent: Device ID = -215317999, Texture = (UnityEngine.Texture2D)
3210 3240 Info Unity [QUVC] Drawing on RawImage for Camera ID: -215317999, RawImage Name: RawImage_R
3210 3240 Info Unity [QUVC]Connected Camera IDs:
3210 3240 Info Unity [QUVC] - Camera ID: 477407871, Device Name: /dev/bus/usb/002/003
3210 3240 Info Unity [QUVC] - Camera ID: -215317999, Device Name: /dev/bus/usb/002/006
3210 3240 Info Unity [QUVC]Connected Camera IDs:
3210 3240 Info Unity [QUVC] - Camera ID: 477407871, Device Name: /dev/bus/usb/002/003
3210 3240 Info Unity [QUVC] - Camera ID: -215317999, Device Name: /dev/bus/usb/002/006

I would appreciate any help you can provide.
Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions