MyPhone's API? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

MyPhone's API?

hey PROgrammers... I am currently working on a project(in java), where I use webcam... goal: I am trying to get my phone's(android) camera to appear as a webcam... Issue: Is there any way I can achieve that? Like control my phone's camera using PC... I did research on android API and googles API, there are very few resource available... every YouTubers are saying random thing(different ideas)... caz it's a complicated subject XD I just want to know, how to achieve it? Any API that I can use? Again, my goal: get access to my phone's camera, and control it using my code(like capture, record, display scene, etc...) other info: project is in java(12) using windows(10) using android phone(Motorola) Thanks, much sololearn community! -Orange

18th May 2020, 2:36 AM
KingDaniel2004
KingDaniel2004 - avatar
1 Answer
+ 1
/** A safe way to get an instance of the Camera object. */ public static Camera getCameraInstance(){ Camera c = null; try { c = Camera.open(); // attempt to get a Camera instance } catch (Exception e){ // Camera is not available (in use or does not exist) } return c; // returns null if camera is unavailable } The Android framework includes support for various cameras and camera features available on devices, allowing you to capture pictures and videos in your applications. kindly visit mentioned url for more details: https://developer.android.com/guide/topics/media/camera
19th May 2020, 9:13 AM
Kamal
Kamal - avatar