private static Camera PublishCameraSync(Camera camera, string address, int port) { MediaService service = GetDeviceConnectorServiceSync(camera.HostUri); if (service != null) { PublishCameraRequest request = new PublishCameraRequest() { CameraId = camera.Id, Destination = new PublishDestinationData() { Address = address, Port = port, }, }; PublishCameraResponse response = ServiceProvider .GetService<IDeviceConnectorService, IDeviceConnectorCallbackService>( ViewModelLocator.ServiceClient, service.HostName, service.Uri.ToString()) .PublishCamera(request); } return camera; }
public PublishCameraResponse PublishCamera(PublishCameraRequest request) { try { if (request == null) throw new ArgumentNullException("request"); PublishCameraResponse response = new PublishCameraResponse(); Locator.Get<IStreamingManager>().PublishCamera(request.CameraId, PublishedCameraTranslator.Translate(request.Destination)); return response; } catch (Exception ex) { throw new FaultException<DeviceConnectorServiceFault>(new DeviceConnectorServiceFault(ex.Message, ex), ex.Message); } }