Unable to get channel from a camera

As I asked before on that thread https://developer.milestonesys.com/s/question/0D50O00004rnhO6SAI/set-the-default-resolution-when-asking-for-a-stream?t=1538115309471 I’ve got issues getting the Channels from a camera

My snippet of code is

   var cameraItem = await videoService.GetItemFromNameAsync(model.Name);
                    if (cameraItem == null)
                    {
                        await messageService.ShowErrorAsync($"Unable to find a camera with name {model.Name} ");
                        return;
                    }
 
                    var streamSource = new StreamDataSource(cameraItem);
 
                    var streamTypes = streamSource.GetTypes();
                    Guid? channelGuid = null;
 
                    if (streamTypes!= null && streamTypes.Any())
                    {
                        //I search for a corresponding channel name
 
                        var stream  = streamTypes.FirstOrDefault(x => x.Name == model.CurrentChannelName);
                        if(stream != null)
                            channelGuid = stream.Id;
                    }

The videoService.GetItemFromNameAsync implementation is

 public Task<Item> GetItemFromNameAsync(string cameraName)
        {
            return Task.Factory.StartNew(() =>
            {
              //  var items = VideoOS.Platform.Configuration.Instance.GetItemsBySearch(cameraName, 10, CameraConnectionTimeout, out var result);
 
 
              var items=  VideoOS.Platform.Configuration.Instance.GetItemsBySearch(cameraName, 100, 60, out var result);
 
                Log.Info($"Found {items.Count} corresponding for name {cameraName}");
 
                var item = items.FirstOrDefault();
 
                Log.Debug($"Camera search result for {cameraName}:{result}");
                if (result == SearchResult.OK || item != null)
                {
                    return item;
                }
                else
                {
                    Log.Error($"Returning null for camera {cameraName}");
                    return null;
                }
            });
        }

But it returns just 1 camera

The kind of the camera is

What happens is that this code returns null for FQID

    var streamSource = new StreamDataSource(cameraItem);
 
    var streamTypes = streamSource.GetTypes(); <--here

What sounds odd to me is that if I look at the code generated decompiling I got

   public override List<DataType> GetTypes()
    {
      StreamType[] streamTypes = InternalConfigService.Instance.GetStreamTypes(this.Item.FQID);
      List<DataType> dataTypeList = new List<DataType>();
      foreach (StreamType streamType in streamTypes)
        dataTypeList.Add(new DataType()
        {
          Id = streamType.Id,
          Name = streamType.Name,
          Properties = streamType.Properties
        });
      return dataTypeList;
    }

The InternalConfigService.GetStreamTypes(FQID deviceFQID) is implemented as

 public virtual StreamType[] GetStreamTypes(FQID deviceFQID)
    {
      return new StreamType[0];
    }

Am I missing something or it returns always null?

Thanks

If you have a camera where the camera driver does not support multiple live streams it returns always null. So if you get null, there is only one stream and you can omit the streamId.

Can you set up multiple live streams for this camera in the Management Client?

I would like to see a screen capture of the Settings and Streams tab in the Management Client for this camera.

I can only set a Live stream, if I check on the second stream the checkbox, it unchecks on the first..

Here’re the screens

Thanks

The screen captures confirms my suspicion: This camera does not support multiple live streams.

With such a camera the code you implement should handle it this way: When you get null the cmaera does not support multiple live streams and you should then use the camera without using a streamId to ask for a specific stream.