public static MediaDevice[] GetAvailableMediaDevices() { DiscoveryClient discoveryClient = new DiscoveryClient(new UdpDiscoveryEndpoint(DiscoveryVersion.WSDiscoveryApril2005)); FindCriteria findCriteria = new FindCriteria { Duration = TimeSpan.FromSeconds(1), MaxResults = 15 }; findCriteria.ContractTypeNames.Add(new XmlQualifiedName("NetworkVideoTransmitter", @"http://www.onvif.org/ver10/network/wsdl")); FindResponse findResponse = discoveryClient.Find(findCriteria); List <MediaDevice> cameras = new List <MediaDevice>(); foreach (var point in findResponse.Endpoints) { Uri uri = point.ListenUris.FirstOrDefault(u => u.HostNameType == UriHostNameType.IPv4); if (uri != null) { string name = ONVIFAgent.GetDeviceInformation(uri); cameras.Add(new MediaDevice(name, uri)); } } return(cameras.ToArray()); }
public MediaDevice(string name, Uri uri) { MediaDeviceUri = uri; DisplayName = name; mediaStream = new MediaStreamAgent(this); onvif = new ONVIFAgent(this); //avProcessor = new AVProcessorAgent(this); Decoder = new AVDecoderAgent(this); }
public object[] FindDevices() { mediaDeviceCollection = ONVIFAgent.GetAvailableMediaDevices(); return(mediaDeviceCollection); }