웹앱에서 모바일 카메라에 액세스하는 방법은 무엇입니까?
모바일 용 웹 앱 (기본 앱 아님)에서 사진을 찍고 업로드하고 싶지만 Adobe Flash를 사용하고 싶지 않습니다. 이것을 할 수있는 방법이 있습니까?
iPhone iOS6 및 Android ICS부터 HTML5에는 장치에서 사진을 찍을 수있는 다음과 같은 태그가 있습니다.
<input type="file" accept="image/*" capture="camera">
Capture
카메라, 캠코더 및 오디오와 같은 값을 사용할 수 있습니다.
나는이 태그가 iOS5에서 확실히 작동하지 않을 것이라고 생각합니다.
요즘 적어도 안드로이드에서는 비교적 쉽습니다. 일반 파일 입력 태그 만 사용하면 사용자가이 태그를 클릭하면 카메라 (또는 파일 관리자 등)를 사용하여 파일을 업로드 할 것인지 묻습니다. 카메라로 사진을 찍기 만하면 자동으로 추가 및 업로드됩니다.
아이폰에 대해서는 전혀 모른다. 누군가가 그것에 대해 깨달을 수 있습니다. 편집 : 아이폰도 비슷하게 작동합니다.
입력 태그 샘플 :
<input type="file" accept="image/*" capture="camera">
iOS 6 이상 및 Android 2.2 이상의 Safari 및 Chrome은 HTML 미디어 캡처를 지원하므로 장치의 카메라로 사진을 찍거나 기존 카메라를 선택할 수 있습니다.
<input type="file" accept="image/*">
iOS 10에서 작동하는 방법은 다음과 같습니다.
iOS10.3 +의 Android 3.0 이상 및 Safari도 capture
카메라로 바로 이동하는 데 사용되는 속성을 지원합니다 .
<input type="file" accept="image/*" capture>
capture="camera"
(문자열) 및 accept="image/*;capture=camera"
(매개 변수)는 이전 사양의 일부였으며 capture
W3C 후보 추천 으로 (부울) 로 대체되었습니다 .
지원 문서 :이 2013 O'Reilly 서적 및 테스트
이것을 업데이트하기 위해 표준은 다음과 같습니다.
<input type="file" name="image" accept="image/*" capture="environment">
주변 카메라 (후면)에 액세스하고
<input type="file" name="image" accept="image/*" capture="user">
사용자 용 (전면) 카메라 용. 비디오에 액세스하려면 이름에서 "image"대신 "video"를 사용하십시오.
iOS 10.3.3, 펌웨어 760을 실행하는 iPhone 5c에서 테스트되었으며 정상적으로 작동합니다.
https://www.w3.org/TR/html-media-capture/
well, there's a new HTML5 features for accessing the native device camera - "getUserMedia API"
NOTE: HTML5 can handle photo capture from a web page on Android devices (at least on the latest versions, run by the Honeycomb OS; but it can’t handle it on iPhones but iOS 6 ).
You can use WEBRTC but unfortunately it is not supported by all web browsers. BELOW IS THE LINK TO SHOW WHICH BROWSERS supports it http://caniuse.com/stream
And this link gives you an idea of how you can access it(sample code). http://www.html5rocks.com/en/tutorials/getusermedia/intro/
AppMobi HTML5 SDK once promised access to native device functionality - including the camera - from an HTML5-based app, but is no longer Google-owned. Instead, try the HTML5-based answers in this post.
It should be noted that security features have been implemented which require either the app to be ran locally under localhost, or through SSL for GetUserMedia() to work.
I discovered this when trying several of the demos available and was dissapointed when they didn't work! See: New Security Restrictions
I don't think you can - there is a W3C draft API to get audio or video, but there is no implementation yet on any of the major mobile OSs.
Second best
The only option is to go with Dennis' suggestion to use PhoneGap. This will mean you need to create a native app and add it to the mobile app store/marketplace.
I don't know of any way to access a mobile phone's camera from the web browser without some additional mechanism (i.e. Flash or some type of container that allows access to the hardware API)
For the latter have a look at PhoneGap: http://docs.phonegap.com/phonegap_camera_camera.md.html
With this you should be able to access the camera at least on iOS and Android-based devices.
You'll want to use getUserMedia to access the camera.
이 자습서는 브라우저에서 장치 카메라에 액세스하는 기본 사항을 간략하게 설명합니다. https://medium.com/@aBenjamin765/make-a-camera-web-app-tutorial-part-1-ec284af8dddf
참고 : 이것은 대부분의 Android 기기와 iOS의 Safari에서만 작동합니다.
참고 URL : https://stackoverflow.com/questions/8581081/how-to-access-a-mobiles-camera-from-a-web-app
'Programing' 카테고리의 다른 글
InvokeRequired 코드 패턴 자동화 (0) | 2020.05.22 |
---|---|
java.lang.ClassNotFoundException 가져 오기 : org.apache.commons.logging.LogFactory 예외 (0) | 2020.05.22 |
스크립트 자체 내에서 전체 셸 스크립트의 출력을 어떻게 리디렉션합니까? (0) | 2020.05.22 |
페이지의 일부에 어떻게 링크합니까? (0) | 2020.05.22 |
마크 다운에 두 개의 빈 줄 만들기 (0) | 2020.05.22 |