Mob.Photos (mob v0.6.16)

Copy Markdown View Source

Photo / video library picker.

On iOS 14+ no permission is required for the picker (it runs out of process). Mob.Storage.save_to_photo_library/2 does require NSPhotoLibraryAddUsageDescription in Info.plist. On Android, READ_MEDIA_IMAGES / READ_MEDIA_VIDEO (API 33+) or READ_EXTERNAL_STORAGE (API ≤ 32) need to be declared in AndroidManifest.xmlmix mob.new ships all three. See the permissions guide for the cross-platform table.

Results arrive as:

handle_info({:photos, :picked,    items},   socket)
handle_info({:photos, :cancelled},           socket)

Each item in items is:

%{path: "/tmp/mob_pick_xxx.jpg", type: :image | :video,
  width: 1920, height: 1080}

iOS: PHPickerViewController. Android: PickMultipleVisualMedia.

Summary

Functions

pick(socket, opts \\ [])

@spec pick(
  Mob.Socket.t(),
  keyword()
) :: Mob.Socket.t()