How to change Live Photo metadata to convert to Loop or Bounce?

709 Views Asked by At

I have done quite a bit of research on Apple's Live Photos but they seem to not provide any information on changing a Live Photo to a loop or a bounce.

My goal is to change the format of a live photo to a loop or bounce like Apple does in the Photos App.

I understand that the user can convert the Live Photo in the photos app and then I can retrieve it with an image picker and then display as a looping video. Somehow Apple has rewritten the Live photo, either by changing the meta data of the Live Photo so the video player knows how to play it or by rewriting the video entirely with their own "secret sauce".

Background: -The media asset has been selected and is now inside my app for processing. -The current selected media type is a plain Live Photo -The user decides sometime during the editing process that they want to change the format of the Live Photo to a bounce.

Question: Is there a way in which I can either rewrite the metadata of these assets to change them into a Live Photo, loop, or bounce regardless of the current type, or do I have to rewrite the video somehow?

This is the output I get when examining the resources of the returned media asset from the picker. Each asset has the same paired resources whether a Live Photo or bounce or Loop. These are descriptions of the media I am inspecting.

The first output is when I choose a plain Live Photo

Photo Live //Media Type
8          //Media Type Int
Adjustment Data  //Paired adjustment data
Paired Video     //The paired video
Full Size Paired Video //Full Size Paired Video
Photo //paired photo
Full Size Photo   //Full size paired photo

This is the output I get when I choose a "Bounce" Live Photo. I have added extra print statements to get more info about each paired resource

Video looping
Asset Media metadata can be edited:  Optional(true)
Asset Media content can be edited:  Optional(true)
Asset Media duration:  Optional(0.0)
Photo Live
8
Adjustment Data
Asset Local ID DFEA976C-7A34-4C2C-823A-C396D1EA2657/L0/001
Asset Local ID Adjustments.plist
Asset Local ID com.apple.property-list
Paired Video
Asset Local ID DFEA976C-7A34-4C2C-823A-C396D1EA2657/L0/001
Asset Local ID IMG_1001.MOV
Asset Local ID com.apple.quicktime-movie
Photo
Asset Local ID DFEA976C-7A34-4C2C-823A-C396D1EA2657/L0/001
Asset Local ID IMG_1001.JPG
Asset Local ID public.jpeg
Full Size Photo
Asset Local ID DFEA976C-7A34-4C2C-823A-C396D1EA2657/L0/001
Asset Local ID FullSizeRender.jpg
Asset Local ID public.jpeg
Full Size Paired Video
Asset Local ID DFEA976C-7A34-4C2C-823A-C396D1EA2657/L0/001
Asset Local ID FullSizeRender.mov
Asset Local ID com.apple.quicktime-movie
0

There are 0 best solutions below