@@ -17,7 +17,7 @@ public class VideoIn : IVideoSource2, IDisposable
1717 private readonly BehaviorSubject < Acquisition ? > _aquicitionStarted = new BehaviorSubject < Acquisition ? > ( null ) ;
1818
1919 private int _changedTicket ;
20- private Advanced . DeviceInfo ? _device ;
20+ private Advanced . DeviceInfo ? _deviceInfo ;
2121 private Int2 _resolution ;
2222 private int _fps ;
2323 //private IConfiguration? _configuration;
@@ -43,9 +43,9 @@ public VideoIn([Pin(Visibility = PinVisibility.Hidden)] NodeContext nodeContext)
4343 out string Info )
4444 {
4545 // By comparing the device info we can be sure that on re-connect of the device we see the change
46- if ( ! Equals ( device ? . Tag , _device ) || enabled != _enabled || resolution != _resolution || FPS != _fps ) // || configuration != _configuration)
46+ if ( ! Equals ( device ? . Tag , _deviceInfo ) || enabled != _enabled || resolution != _resolution || FPS != _fps ) // || configuration != _configuration)
4747 {
48- _device = device ? . Tag as Advanced . DeviceInfo ;
48+ _deviceInfo = device ? . Tag as Advanced . DeviceInfo ;
4949 _resolution = resolution ;
5050 _fps = FPS ;
5151 //_configuration = configuration;
@@ -64,12 +64,17 @@ public VideoIn([Pin(Visibility = PinVisibility.Hidden)] NodeContext nodeContext)
6464
6565 IVideoPlayer ? IVideoSource2 . Start ( VideoPlaybackContext ctx )
6666 {
67- var device = _device ;
68- if ( device is null )
67+ var deviceInfo = _deviceInfo ;
68+ if ( deviceInfo is null )
6969 return null ;
7070
7171 try
7272 {
73+ //get the device either from the list of auto-enumerated devices
74+ Device ? device = ContextManager . GetHandle ( ) . Resource . QueryDeviceList ( ) . GetDeviceBySN ( deviceInfo . SerialNumber ) ;
75+ //or from the manually created list of NetDevices
76+ if ( device == null )
77+ device = OrbbecDeviceDefinition . Instance . GetDeviceBySN ( deviceInfo . SerialNumber ) ;
7378 var result = Acquisition . Start ( this , device , _logger , _resolution , _fps ) ; //, _configuration
7479 //_aquicitionStarted.OnNext(result);
7580 return result ;
0 commit comments