HTML5: camera access

前端 未结 9 2092
广开言路
广开言路 2020-12-02 06:51

I am quite new to HTML5. I try the following HTML5 code to access camera on my mobile phone. It always display \"Native web camera not supporte

相关标签:
9条回答
  • 2020-12-02 06:56

    You can use Chrome for Android by enabling the "Enable WebRTC" flag under chrome://flags

    I tested on my android phone to access camera on html5 page and it's working.

    0 讨论(0)
  • 2020-12-02 06:57

    HTML5 added support for camera access, you can use it like this:

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

    Where user is for front camera and environment is for back camera.

    0 讨论(0)
  • 2020-12-02 07:00

    We've had some success with this basic approach cobbled together from across the Web:

    <form method="post" action="takephoto.php" enctype="multipart/form-data">
    <input type="file" accept="image/*" name="file">
    <input type="submit">
    </form>
    

    Then in the PHP file we generate unique file names using now() or something similar for storage.

    0 讨论(0)
  • 2020-12-02 07:01

    This works on Firefox mobile, Chrome mobile, iPhone and Android:

    <input type="file" id="mypic" accept="image/*">
    
    0 讨论(0)
  • 2020-12-02 07:01

    Opera Desktop, Opera mobile and Chrome (after changing some configuration) supports HTML5 camera / microphone access so far.

    0 讨论(0)
  • 2020-12-02 07:12
    <input type="file" accept="image/*;capture=camera">
    

    See Capturing Audio & Video in HTML5

    Support:

    • Android 3.0 browser - one of the first implementations. Check out this video to see it in action.
    • Chrome for Android (0.16)
    • Firefox Mobile 10.0
    • iOS6 Safari and Chrome (partial support)
    0 讨论(0)
提交回复
热议问题