SOCommMediaClient

Interface for a client that handles all media-related topics with a remote SOComm device. This can be seen as a facade / middleware to communicate with the PictureManager of the SOComm device. To initialize / de-initialize this client, call start / stop respectively. After start has been called, this client will wait until a connection to the SOComm device is established (this client will not establish the connection itself, the connection needs to be established on the provided com.swarovskioptik.comm.SOCommOutsideAPI provided to the SOCommMediaClientBuilder when creating a new SOCommMediaClient). After the connection has been established, the respective com.swarovskioptik.comm.definition.SOContexts will be used in order to receive either picture or video thumbnails. On connection interruptions / disconnect & reconnect events, the this client will automatically recover.

This is to be used in combination with an instance of com.swarovskioptik.comm.SOCommOutsideAPI.

Use the SOCommMediaClientBuilder to create new instances of this client. One client can either serve pictures, videos or both at the same time. Check SOCommMediaClientBuilder.mediaTypes for that. However, multiple instances of this client (e.g. one for pictures and one for videos) can also be used at the same time.

Types

Link copied to clipboard

An enum containing all possible states this client can be in:

Link copied to clipboard
interface ExternalSource

A somewhat public API to insert media items from an external source into this MediaClient.

Properties

Link copied to clipboard
@get:CheckReturnValue
abstract val availableMedia: Observable<List<AvailableMediaItem>>

The emitted Observable emits a list of available media items on the remote device. The list will only retrieve new items / updates, when an active connection to a remote device is established (i.e. when this MediaClients connectionState is in the ConnectedToPreview or ConnectedToMediaDownload state).

Link copied to clipboard
@get:CheckReturnValue
abstract val availableThumbnails: Observable<List<MediaItem.Thumbnail>>

The emitted Observable emits a new list at any change of available media items on the remote device. The list will only retrieve new items / updates, when an active connection to a remote device is established (i.e. when this MediaClients connectionState is in the ConnectedToPreview or ConnectedToMediaDownload state).

Link copied to clipboard
@get:CheckReturnValue
abstract val connectionState: Observable<SOCommMediaClient.ConnectionState>

The emitted ConnectionState states the state this client is currently in.

Link copied to clipboard
@get:CheckReturnValue
abstract val localMedia: Observable<List<MediaItem.Local>>

Returns an Observable which contains the list of files (and updates thereof) of locally stored media files.

Functions

Link copied to clipboard
@CheckReturnValue
abstract fun batchDelete(localMediaItems: List<MediaItem.Local>): Completable

Deletes all given localMediaItems from the local storage. This is a permanent delete that cannot be undone.

Link copied to clipboard
@CheckReturnValue
abstract fun delete(localMediaItem: MediaItem.Local): Completable

Deletes a given localMediaItem from the local storage. This is a permanent delete that cannot be undone.

Link copied to clipboard
@CheckReturnValue
abstract fun downloadMedia(): Observable<MediaItemDownloadProgress>

Downloads all available media items in full resolution, so that all items currently available as thumbnails (or only as filenames) will be stored locally and made accessible as localMedia.

Link copied to clipboard

Returns an implementation of ExternalSource for the given mediaType.

Link copied to clipboard
abstract fun getMediaItemSource(mediaItem: MediaItem): MediaItemSource

Returns a MediaItemSource for the given mediaItem. This method should be used when trying to get the content of a MediaItem.

Link copied to clipboard
@CheckReturnValue
abstract fun start(): Completable

Needs to be called before calling / using any of this class' methods.

Link copied to clipboard
@CheckReturnValue
abstract fun stop(): Completable

To be called when this manager should stop operating. This will release the com.swarovskioptik.comm.definition.SOContexts used by this manager as well as any other resources.

Link copied to clipboard
@CheckReturnValue
abstract fun turnOffMediaDownload(): Completable

Stops the automatic downloading of media files (pictures or videos, depending on the MediaType) that has been started by calling turnOnMediaDownload.

Link copied to clipboard
@CheckReturnValue
abstract fun turnOnMediaDownload(): Completable

Initiates the download of all media files (pictures or videos, depending on the MediaType) available on the remote device.