How to judge files are spatial media in Swift?

If I got a file or a file URL, how to judge it is a spatial photo, a panorama photo or a spatial video? Apple's Photo app can do it.

Answered by Vision Pro Engineer in 800240022

Hello @NahtanMak,

The PhotoKit framework provides PHAssetMediaSubtype that identify specific variations of asset media. Two of the subtypes are relevant to your question: photoPanorama and spatialMedia.

A code snippet showing a HDR badge is included in the mediaSubtypes documentation.

Additionally, AVFoundation also have a few properties worth noting:

Let me know if that helps or if you need more information,
Michael

Accepted Answer

Hello @NahtanMak,

The PhotoKit framework provides PHAssetMediaSubtype that identify specific variations of asset media. Two of the subtypes are relevant to your question: photoPanorama and spatialMedia.

A code snippet showing a HDR badge is included in the mediaSubtypes documentation.

Additionally, AVFoundation also have a few properties worth noting:

Let me know if that helps or if you need more information,
Michael

How to judge files are spatial media in Swift?
 
 
Q