GSMediaStore

@objc(GSMediaStore)
public protocol GSMediaStore : Peripheral

Objective-C version of MediaStore.

Note

This class is for Objective-C only and must not be used in Swift.
  • 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 the it has been loaded and each time the content changes.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newList:)
    func newListRef(observer: @escaping (_ medias: [MediaItem]?) -> Void) -> GSMediaListRef

    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 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

    @objc(newThumbnailDownloaderForMedia:observer:)
    func newThumbnailDownloaderRef(media: MediaItem, observer: @escaping (_ thumbnail: UIImage?) -> Void)

    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.

  • Creates a new media resource downloader.

    Declaration

    Swift

    @objc(newDownloaderForMediaResources:destination:observer:)
    func newDownloaderRef(mediaResources: MediaResourceList, destination: GSDownloadDestination, observer: @escaping (_ downloader: MediaDownloader?) -> Void) -> GSMediaDownloaderRef

    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.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newDeleterForMedia:observer:)
    func newDeleterRef(medias: [MediaItem], observer: @escaping (_ deleter: MediaDeleter?) -> Void)

    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 all medias.

    Note

    This function is for Objective-C only.

    Declaration

    Swift

    @objc(newAllMediasDeleterWithObserver:)
    func newAllMediasDeleterRef(observer: @escaping (_ deleter: AllMediasDeleter?) -> Void) -> GSAllMediasDeleterRef

    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.