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


