반응형
AVFoundation은 Objective-C 및 Swift의 API가 포함 된 멀티미디어 프레임 워크
AVPlayer로 동영상 / 오디오 파일을 재생하기 위해서는 AVFoundation 프레임워크를 먼저 import 해주어야 한다.
AVPlayer를 살펴보면 URL을 이용하여 불러오는 방식과 AVPlayerItem을 이용하여 파일을 불러오는 방식이 있다.
open class AVPlayer : NSObject {
public init(url URL: URL) //initWithURL
public init(playerItem item: AVPlayerItem?) //initWithPlayerItem
open var status: AVPlayer.Status { get }
}
extension AVPlayer {
open var rate: Float
open func play()
open func pause()
open func currentTime() -> CMTime //Returns the current time of the current item
//Moves the playback cursor
open func seek(to time: CMTime)
//Moves the playback cursor within a specified time bound
open func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime)
open func seek(to time: CMTime, completionHandler: @escaping (Bool) -> Void)
open func seek(to time: CMTime, toleranceBefore: CMTime, toleranceAfter: CMTime, completionHandler: @escaping (Bool) -> Void)
open var volume: Float
open var isMuted: Bool
}
728x90
반응형