2

I'm having some trouble creating a PHLivePhotoEditingContext in order to apply filters using CoreImage.

However, in order to create a PHLivePhotoEditingContext the steps are to:

  1. Instantiate a PHAsset object.
  2. Call the requestContent​Editing​Input(with:​completion​Handler:​)
  3. Use the PHContentEditingInput to instantiate a PHLivePhotoEditingContext.

However, my understanding of PHAsset is it's only available for apps and not Swift Playgrounds. Am I wrong in that assessment? If I'm wrong are there any ways to create a PHLivePhotoEditingContext to edit live photos in my swift playground (stored in the Resources directory as a .mov and .JPG? If I can't create a PHLivePhotoEditingContext are there alternate ways to efficiently apply Core Image filters onto live photos within my playground?

I'm currently writing my code out in a playground but ultimately​ it will go in a playground book, so if it works in the playground book and not the playground that is fine.

Harish
  • 1,374
  • 17
  • 39
  • 1
    My understanding of PHAsset is the same. not sure how we can retrieve the PHAsset in the playground, I tried to load PHAsset from URL in the playground but failed (maybe you can try play with that). And talking about Live Photo in the playground, maybe you want read here http://stackoverflow.com/questions/33990830/working-with-live-photos-in-playground – XueYu Mar 23 '17 at 23:40
  • @XueYu Yup, I'm failing to load it from the URL too. Just out of curiosity does it just say PHUnauthorizedFetchResult? That's what I'm getting. – Harish Mar 23 '17 at 23:52
  • 1
    I tried several ways got different errors, I tried with the answers here and got nil → http://stackoverflow.com/questions/28661938/retrieve-alasset-or-phasset-from-file-url – XueYu Mar 23 '17 at 23:54
  • One possible solution would maybe just split the video into frames myself and modify them like that. The thing is I am building a playground book so if it works and there and not the playground that is fine too.. – Harish Mar 23 '17 at 23:55

0 Answers0