MediaStore

public protocol MediaStore : Peripheral

Aggregated media store. Contains information on all medias stored on a device, aggregating media on different stores.

  • Current indexing state of the media store.

    Declaration

    Swift

    var indexingState: MediaStoreIndexingState { get }
  • Total number of photo medias in the media store.

    Declaration

    Swift

    var photoMediaCount: Int { get }
  • Total number of video medias in the media store.

    Declaration

    Swift

    var videoMediaCount: Int { get }
  • Total number of photo resources in the media store.

    Declaration

    Swift

    var photoResourceCount: Int { get }
  • Total number of video resources in the media store.

    Declaration

    Swift

    var videoResourceCount: Int { get }
  • Creates a new Media list.

    This function starts loading the media store content, and notify when it has been loaded and each time the content changes.

    Declaration

    Swift

    func newList(observer: @escaping (_ medias: [MediaItem]?) -> Void) -> Ref<[MediaItem]>

    Parameters

    observer

    observer notified when the media list has been loaded or has change.

    medias

    list media, nil if the store has been removed

    Return Value

    a reference on a list of MediaItem. Caller must keep this instance referenced for the observer to be called.

  • Creates a new media thumbnail downloader.

    Note

    Typical usage in a UITableView is to call ‘newMediaThumbnailDownloader’ in ‘UITableViewDataSource. tableView:cellForRowAt:’ and store the returned ‘Ref’ inside the ‘UITableViewCell’. Then in the ‘UITableViewCell.prepareForReuse’ function set the ‘Ref’ to cancel the download request.

    Declaration

    Swift

    func newThumbnailDownloader(media: MediaItem, observer: @escaping (_ thumbnail: UIImage?) -> Void) -> Ref<UIImage>

    Parameters

    media

    media item to download the thumbnail from

    observer

    observer called when the thumbnail has been downloaded. Observer is called immediately if the thumbnail is already cached

    thumbnail

    loaded or cached thumbnail, nil if the thumbnail can’t be downloaded

    Return Value

    A reference of the media downloader. Caller must keep this instance referenced for the observer to be called.

  • Create a new resource thumbnail downloader

    Note

    Typical usage in a UITableView is to call ‘newMediaThumbnailDownloader’ in ‘UITableViewDataSource. tableView:cellForRowAt:’ and store the returned ‘Ref’ inside the ‘UITableViewCell’. Then in the ‘UITableViewCell.prepareForReuse’ function set the ‘Ref’ to cancel the download request.

    Declaration

    Swift

    func newThumbnailDownloader(resource: MediaItem.Resource, observer: @escaping (_ thumbnail: UIImage?) -> Void) -> Ref<UIImage>

    Parameters

    resource

    resource item to download the thumbnail from

    observer

    observer called when the thumbnail has been downloaded. Observer is called immediately if the thumbnail is already cached

    thumbnail

    loaded or cached thumbnail, nil if the thumbnail can’t be downloaded

    Return Value

    A reference of the resource downloader. Caller must keep this instance referenced for the observer to be called.

  • Creates a new media resource downloader.

    Declaration

    Swift

    func newDownloader(mediaResources: MediaResourceList, destination: DownloadDestination, observer: @escaping (_ downloader: MediaDownloader?) -> Void) -> Ref<MediaDownloader>

    Parameters

    mediaResources

    list of media resources to download

    destination

    download destination

    observer

    observer called when the Media downloader changes, indicating download progress

    Return Value

    a reference on a MediaDownloader. Caller must keep this instance referenced until all media are downloaded. Setting it to nil cancel the download.

  • Creates a new Media deleter, to delete a list of media.

    Declaration

    Swift

    func newDeleter(medias: [MediaItem], observer: @escaping (_ deleter: MediaDeleter?) -> Void) -> Ref<MediaDeleter>

    Parameters

    medias

    medias to delete.

    observer

    observer notified progress of the delete task. Referenced media deleter is nil if the delete task is interrupted.

    deleter

    deleter storing the delete progress info

    Return Value

    a reference on a MediaDeleter. Caller must keep this instance referenced until all media are deleted. Setting it to nil cancel the delete.

  • Creates a new Media deleter, to delete a list of media resources.

    Declaration

    Swift

    func newDeleter(mediaResources: MediaResourceList, observer: @escaping (_ deleter: MediaDeleter?) -> Void)

    Parameters

    mediaResources

    list of media resources to delete

    observer

    observer notified progress of the delete task. Referenced media deleter is nil if the delete task is interrupted.

    deleter

    deleter storing the delete progress info

    Return Value

    a reference on a MediaDeleter. Caller must keep this instance referenced until all media are deleted. Setting it to nil cancel the delete.

  • Creates a new media deleter to delete all medias.

    Declaration

    Swift

    func newAllMediasDeleter(observer: @escaping (_ deleter: AllMediasDeleter?) -> Void) -> Ref<AllMediasDeleter>

    Parameters

    observer

    observer notified progress of the delete task. Referenced media deleter is nil if the delete task is interrupted.

    deleter

    deleter storing the delete progress info

    Return Value

    a reference on a AllMediaDeleter. Caller must keep this instance referenced until all media are deleted. Setting it to nil cancel the delete.