0

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 ?

sanchez23
  • 13
  • 4
  • So you have separate video and still photos and you want to _combine_ them to form a live photo? Is that right? – matt Apr 28 '18 at 19:46
  • Might be the same as https://stackoverflow.com/questions/37001612/how-to-make-phlivephoto-from-mov-file – matt Apr 28 '18 at 19:47
  • Very well answered on this page: https://github.com/kean/Nuke/issues/62 – matt Apr 28 '18 at 19:49
  • this code already combine photo and video files successfully, but I want to get these files from web server without saving on disk if it is possible. I will try solution that in your last comment. Thanks for quick response. – sanchez23 Apr 28 '18 at 20:02
  • "without saving on disk if it is possible" I think that discussion makes it clear that that's not possible. That's exactly what the discussion is _about_. – matt Apr 28 '18 at 21:14

0 Answers0