I'am working on an application , it's display live photo in view controller. Live photos contains JPG and MOV file.
I use this code to display live photos which JPG and MOV files located in application.
override func viewDidLoad() {
super.viewDidLoad()
let imgUrl = Bundle.main.url(forResource: "testImage", withExtension: "jpeg")
let videoUrl = Bundle.main.url(forResource: "testVideo", withExtension: "mov")
let previewImg = UIImage(named: "placeholder")
self.makeLivePhoto(imgURL: iu, videoURL: vu, previewImg: previewImg!)
}
func makeLivePhoto(imgURL:URL,videoURL:URL,previewImg:UIImage) {
PHLivePhoto.request(withResourceFileURLs: [imgURL,videoURL], placeholderImage: previewImg, targetSize: CGSize.zero, contentMode: PHImageContentMode.aspectFit, resultHandler: { (livePhoto,info) -> Void in
var livePhotoView:PHLivePhotoView = PHLivePhotoView.init(frame: self.view.bounds)
livePhotoView.livePhoto = livePhoto
livePhotoView.contentMode = UIViewContentMode.scaleAspectFit
self.view.addSubview(livePhotoView)
livePhotoView.startPlayback(with:PHLivePhotoViewPlaybackStyle.hint
)
})
}
I want to get MOV and JPG files from web server.How can I do that ? Is there any method to get JPG and MOV files from web directly ?