- add framework
-- AVKit.framework
-- AVFoundation.framework
- Bulid Phases
-- Copy Bundle Resources
--- add movie clip (a.mp4)
- storyboard
-- add ViewController (AVPlayerViewController)
--- create new AVPlayerViewController and link
- add code
-- AVKit.framework
-- AVFoundation.framework
- Bulid Phases
-- Copy Bundle Resources
--- add movie clip (a.mp4)
- storyboard
-- add ViewController (AVPlayerViewController)
--- create new AVPlayerViewController and link
- add code
override func viewDidLoad(){
super.viewDidLoad()
if let bundlePath = Bundle.main.path(forResource: "a", ofType: "mp4") {
print("bundlePath \(bundlePath)")
let videoPlayer = AVPlayer(url: URL(fileURLWithPath: bundlePath))
self.player = videoPlayer
videoPlayer.play()
}
/*
// streaming
let bundlePath = URL(string: videoClipUrlStr)
print("bundlePath \(bundlePath)")
let videoPlayer = AVPlayer(url: bundlePath!)
self.player = videoPlayer
videoPlayer.play()
*/
}
댓글
댓글 쓰기