macosdelphivideophotomedia-library

Accessing Media Library Photos and Videos on OS X Using Delphi


I am trying to develop a app for OS X El Capitan using Delphi 10 Seattle.

I tried using FMX.MediaLibrary but unfortunately it only works for IOS and Android as and not for OS X. http://docwiki.embarcadero.com/Libraries/Seattle/en/FMX.MediaLibrary.IFMXPhotoLibrary

How to access media Library pictures and videos on Mac OS X?


Solution

  • Unlike on iOS or Android, there is no system media library API. Rather, even a 'sandboxed' Mac application has access to the user's general home directory like on Windows. As such, to prompt the user for a picture or video to open, just use TOpenDialog, and for a location to save to, TSaveDialog.

    That said, if you are intending to create a sandboxed application, make sure you do use TOpenDialog/TSaveDialog (or their underlying Cocoa equivalents, NSOpenPanel and NSSavePanel). This is because the OS will only allow a sandboxed application to open or save to a file that it knows the user has explicitly asked the application to operate on.