[swift] 비디오 파일을 Swift에서 재생하는 방법
import AVKit

if let path = Bundle.main.path(forResource: "video", ofType: "mp4") {
    let player = AVPlayer(url: URL(fileURLWithPath: path))
    let playerViewController = AVPlayerViewController()
    playerViewController.player = player
    present(playerViewController, animated: true) {
        player.play()
    }
}

AVPlayerViewController를 사용할 경우 기본적인 UI를 제공받을 수 있으며, 사용자가 비디오를 간단히 컨트롤할 수 있습니다.

더 많은 기능을 추가하고 싶을 경우, AVPlayerLayer를 사용하여 자체 UI를 생성하거나 AVPlayer를 직접 제어하여 원하는 대로 비디오를 다룰 수 있습니다.

참고 자료:

다른 도움이 필요하거나 궁금한 점이 있으면 언제든지 물어주세요!