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 notifies when it has been loaded and each time the content changes.
Declaration
Parameters
observer
observer which gets notified when the media list loads or changes
medias
list media,
nil
if the store has been removedReturn Value
a reference on a list of
MediaItem
. Caller must keep this instance referenced for the observer to be called. -
Creates a new Media list for a specific storage.
This function starts loading the media store content on a specific storage, and notifies when it has been loaded and each time the content changes.
Declaration
Swift
func newList(storage: StorageType?, observer: @escaping (_ medias: [MediaItem]?) -> Void) -> Ref<[MediaItem]>
Parameters
storage
storage type on which the Media list will be created
observer
observer which gets notified when the media list loads or changes
medias
list media,
nil
if the store has been removedReturn 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 aUITableView
is to callnewMediaThumbnailDownloader()
inUITableViewDataSource.(tableView:cellForRowAt:)
and store the returnedRef<UIImage>
inside theUITableViewCell
. Then in theUITableViewCell.prepareForReuse()
function set the storedRef<UIImage>
tonil
to cancel the download request.Declaration
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 downloadedReturn 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 aUITableView
is to callnewMediaThumbnailDownloader()
inUITableViewDataSource.(tableView:cellForRowAt:)
and store the returnedRef<UIImage>
inside theUITableViewCell
. Then in theUITableViewCell.prepareForReuse()
function set the storedRef<UIImage>
tonil
to cancel the download request.Declaration
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 downloadedReturn Value
A reference of the resource downloader. Caller must keep this instance referenced for the observer to be called.
-
newDownloader(mediaResources:
Default implementationtype: destination: observer: ) Creates a new media resource downloader.
Note
Iffull
type is selected (default), signatures will also be downloaded. Ifpreview
type is selected, no signature will be downloaded and videos will be ignored.Default Implementation
Creates a new media resource downloader.
Declaration
Swift
func newDownloader(mediaResources: MediaResourceList, type: DownloadType, destination: DownloadDestination, observer: @escaping (_ downloader: MediaDownloader?) -> Void) -> Ref<MediaDownloader>
Parameters
mediaResources
list of media resources to download
type
download type
destination
download destination
observer
observer called when the
MediaDownloader
changes, indicating download progressReturn Value
a reference on a
MediaDownloader
. Caller must keep this instance referenced until all media are downloaded. Setting it tonil
cancels the download. -
Creates a new media resource uploader.
Resource files will be uploaded to the device’s internal storage, in the order defined by the specified
resources
array.Declaration
Swift
func newUploader(resources: [URL], target: MediaItem, observer: @escaping (_ uploader: ResourceUploader?) -> Void) -> Ref<ResourceUploader>
Parameters
resources
resource files to upload
target
target media item to attach uploaded resource files to
observer
observer called when the
ResourceUploader
changes, indicating upload progress and statusReturn Value
a reference on a
ResourceUploader
. Caller must keep this instance referenced for the observer to be called. Setting it tonil
cancels the upload. -
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 called when the
MediaDeleter
changes, indicating progress of the delete task. Referenced media deleter isnil
if the delete task was 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 tonil
cancels 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) -> Ref<MediaDeleter>
Parameters
mediaResources
list of media resources to delete
observer
observer called with
MediaDeleter
changes, indicating progress of the delete task. Referenced media deleter isnil
if the delete task was 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 tonil
cancels 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 called when
AllMediasDeleter
changes, indicating progress of the delete task. Referenced media deleter isnil
if the delete task was 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 tonil
cancels the delete.