.NET Standard Library for Open Spherical Camera API 2.0
var cameraClient = new CameraClient();
cameraClient.TakePicture("test.jpg");
The library exposes CameraClient
class which implements an ICameraClient
interface, which has a set of extension methods on it i.e. TakePicture()
.
var cameraClient = new CameraClient();
var cameraClient = new CameraClient(new IPEndPoint(IPAddress.Parse("192.168.42.1"), 80));
var cameraClient = new CameraClient(new Uri("https://192.168.42.1"));
All CameraClient
constructors takes an optional HttpClientFactoryHandler
createClient
parameter which allows you to override how the internally used HttpClient is created.
Example usage with System.Net
IHttpClientFactory
var serviceProvider = new ServiceCollection().AddHttpClient().BuildServiceProvider();
var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
var cameraClient = new CameraClient(createClient: httpClientFactory.CreateClient);
All CameraClient
constructors takes an optional CreateFileHandler
createFile
parameter which allows you to override how local files are created.
var cameraClient = new CameraClient(
createFile: path => File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None));
var pictureUri = await client.TakePicture();
var imageStream = new MemoryStream();
await client.TakePicture(imageStream);
await client.TakePicture("test.jpg");
All TakePicture
methods takes an optional useLocalFileUri
bool parameter, by default it's false. If set to true it'll use ICameraClient.EndPoint
for construction an absolute uri to images. This is useful if using camera through proxy or firewall.
This library has been tested with