Camera on Android Example

前端 未结 3 925
时光取名叫无心
时光取名叫无心 2020-12-23 10:58

I want to write an activity that:

  1. Shows the camera preview (viewfinder), and has a \"capture\" button.
  2. When the \"capture\" button is pressed, takes a
3条回答
  •  难免孤独
    2020-12-23 11:29

    "the recommended way to access the camera is to open Camera on a separate thread". Otherwise, Camera.open() can take a while and might bog down the UI thread.

    "Callbacks will be invoked on the event thread open(int) was called from". That's why to achieve best performance with camera preview callbacks (e.g. to encode them in a low-latency video for live communication), I recommend to open camera in a new HandlerThread, as shown here.

提交回复
热议问题