5
votes

I have a Blazor Web Assembly PWA, how do I open a devices native camera?

I am trying to write a PWA to capture and save pictures.

EDIT

Would like to save captured images as jpeg's to Azure Blob Storage.

1

1 Answers

9
votes

You can achieve this with HTML input. You only need to add the attribute capture for opening device camera straight away.

<input type="file" accept="image/*" capture>

You can have a look at the full source code here:

https://github.com/mehmettahameral/Blazor-wasm-pwa-camera

and live demo here: https://infallible-bohr-56743b.netlify.app/

--

about saving the images: it depends where do you want to save it really. If you can tell me more, I might update the solution.

Hope it helps 🤞