好拉,不知道有沒人被標題黨騙進來,
(上面這條是跟著鄉民進來看熱鬧的終止線)
前言:在 iOS 中如果想要處理與 media 相關的問題,那第一個想到的一定是 AVFoundation 和與其相關的函式庫,目前預計會發個三篇和此主題有相關的文章,
他在做什麼的?
- AVFoundation 是針對音檔和影片的函式庫; 1、音檔:錄製(創建)/編輯/播放2、影片:錄製(創建)/編輯/播放 3、圖片:拍攝(創建)
他由哪些東西組成?
(AVFoundation stack on iOS)
- You should typically use the highest-level abstraction available that allows you to perform the tasks you want.
在灰色虛線以上的地方,是高階抽象的 API 你可以 AVKit 當作平常使用的 UIkit 去做使用,但是我們今天所要了解與操作的是相對比較下層的 AVFoundation
至於:
-
Core Audio : 就請參考蘋果官方文件,在這邊先不討論
- Core Media 則留到下篇再來討論
- If you simply want to play movies, use the AVKit framework.
- On iOS, to record video when you need only minimal control over format, use the UIKit framework (UIImagePickerController).
他有哪些重要的功能?
主要架構:
- There are two facets to the AVFoundation framework—APIs related to video and APIs related just to audio. The older audio-related classes provide easy ways to deal with audio.
- To play sound files, you can use AVAudioPlayer.
- To record audio, you can use AVAudioRecorder.
You can also configure the audio behavior of your application using AVAudioSession; this is described in Audio Session Programming Guide.