3
<input type="file" accept="image/*;capture=camera">
獲得來自用戶的相機圖像輸入。這是apparently the old way of doing it但這就是他們想要的。
有什麼方法可以指定使用前置(或後置)攝像機嗎?如果需要,用戶仍然可以切換攝像頭,但默認攝像頭將設置爲HTML(也許是屬性?)。
我只需要在Android上使用Chrome,所以跨瀏覽器不是問題。
的Media Capture docs說,用戶應該能夠選擇哪些相機,但它沒有提到開發商:
Similarly, the user agent should allow the user:
-to select the exact media capture device to be used if there exists multiple devices of the same type (e.g. a front-facing camera in addition to a primary camera).