Default HTML5 camera input broken on Android / Chrome

I'm trying to create a simple web app for smartphones that lets the camera app take a picture.

The standard html5 is super simple:

<input type="file"

       accept="image/png, image/jpeg">

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/file

So I tried this.


$ cat index.html

<!doctype html>

<html>

    <body>

        <form action="/store-image/">

            <label for="img">Select image:</label>

            <input type="file" id="img" name="img" accept="image/*" capture="camera">

            <input type="submit">

        </form>

    </body>

</html>

$ python3 -m http.server  


I go to my phone.



Camera pops up, I submit the picture, and ...



"Unable to complete previous operation due to low memory".

Ok, the simplest stock html5 sample doesn't work. Weird. I have a simple Moto G7 Play running Android 10. A 1.5 year old cheap Android phone, just like 80% of the world uses. My memory usage is really not special.

What do Google and Stackoverflow say?


https://c.realme.com/in/post-details/1317318985611476992

Great, I'll tell my users to go to "Free up the ram". Even if I would do that, it doesn't work.

Or this one from 2017.


https://mavislibrary.blogspot.com/2017/07/solution-to-unable-to-complete-previous-operation-due-to-low-memory-solution.html

Sure, I'll tell my users to switch to another browser! Or to enable Developer Options and select an arcane option in the hidden menu! I have to say that both of these do actually work so they're better than the previous solution.

So what the hell? The simplest html5 example doesn't work for 80% of the Android users? Honestly I'm pulling the number out of thin air, but I think it's reasonable to assume that 80% of the world has a crappier phone than myself. If you Google some more, you'll see that all kinds of people have come up with the "Developer Option" workaround. There is no real solution. My guess is that everyone has given up and switched to camera capture from within the browser, or maybe that most developers are using phones that don't have this problem.

Comments

Popular posts from this blog

The unreasonable effectiveness of i3, or: ten years of a boring desktop environment

Idea time: RFID+E-Ink, electronic price tags without batteries

Parsing 10TB of Metadata, 26M Domain Names and 1.4M SSL Certs for $10 on AWS