iT邦幫忙

第 12 屆 iThome 鐵人賽

DAY 14
0

記錄學習內容。看網路上大大們的文章和影片,做些筆記。

來確認AVFoundation相機的功能 ,還沒實作:

1 手電筒:

之前好像是叫flashMode:
flashMode

現在應該是叫torchMode :
torchMode

裡面有個項目是torchLevel , 可以調整手電筒亮度:

The value of this property is a floating-point number whose value is in the range 0.0 to 1.0.

A torch level of 0.0 indicates that the torch is off.

A torch level of 1.0 represents the theoretical maximum value

AVCaptureDevice.TorchMode ,閃光有三種模式可以設定:
https://ithelp.ithome.com.tw/upload/images/20200914/20111994t79KrOebBv.png

有一些檢查 有沒有手電筒 或是 閃光模式 的方法 ,
用來防止 如果手機沒有手電筒 ,程式會crash之類的 。

2 zoom放大縮小

videoZoomFactor

Pinch to zoom camera

A value that controls the cropping (裁減)and enlargement(放大) of images captured by the device.

For example, a value of 2.0 doubles the size of an image’s subject

3 前鏡頭、後鏡頭 切換:

AVCaptureDevice.Position

https://ithelp.ithome.com.tw/upload/images/20200914/201119940QHLyQaZdH.png

4 解析度

How to change size setting of video capturing by AVFoundation
AVCaptureSessionPreset
像是有

AVCaptureSessionPresetiFrame1280x720
Specifies capture settings to achieve 1280 x 720 quality iFrame H.264 video at about 40 Mbits/sec with AAC audio.

這個好像也是類似 , 還不懂,實作後在觀察:
inputPriority
不懂這句話意思:

Specifies that the capture session does not control audio and video output settings.

5 focusMode

focusMode
AVCaptureDevice.FocusMode

https://ithelp.ithome.com.tw/upload/images/20200914/20111994aQsMmZ0eif.png

尋找程式

UIViewController 版本的camera :
IlijaMihajlovic/AVFoundation-Camera-App

SwiftUI版本的camera :
brettfazio/CameraView

相機畫面跟這個有關:
UIViewRepresentable

如果要在SwiftUI 使用UIKit的東西 ,使用UIViewRepresentable:

A wrapper for a UIKit view that you use to integrate that view into your SwiftUI view hierarchy.


上一篇
OAuth 2.0 and OpenID Connect
下一篇
@State,@Published,@ObservedObject,@EnvironmentObject
系列文
iOS學習資源與筆記28
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言