Interface CachingTask

  • All Implemented Interfaces:
    com.theoplayer.android.api.event.EventDispatcher

    
    public interface CachingTask
     implements EventDispatcher<E>
                        

    Represents a caching task.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract String getId() The identifier of the task.
      abstract CachingTaskStatus getStatus() The current status of the task.
      abstract SourceDescription getSource() The media source associated with the task.
      abstract CachingParameters getParameters() The configuration of the task.
      abstract double getDuration() The requested cached duration of the media, in seconds.
      abstract long getBytes() The estimation of the amount this task will download and store, in bytes.
      abstract long getBytesCached() The amount downloaded and stored, in bytes.
      abstract TimeRanges getCached() The time ranges indicating the data which has been cached.
      abstract double getSecondsCached() The amount of content that has been cached.
      abstract double getPercentageCached() The percentage of content that has been cached.
      abstract Integer getStatusNotificationId() The notification identifier of the task when showing its status notification.
      abstract Integer getProgressNotificationId() The notification identifier of the task when showing its progress notification.
      abstract CachingTaskLicense license() The API for license related queries and operations.
      abstract void start() Start caching the media.
      abstract void pause() Pause caching the media.
      abstract void remove() Remove the cached media.
      abstract CachingTaskError getError() The last error that occurred while Caching, if any.
      • Methods inherited from class com.theoplayer.android.api.event.EventDispatcher

        addEventListener, removeEventListener
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • getId

        @NonNull() abstract String getId()

        The identifier of the task. (NonNull)

        Returns:

        The task identifier.

      • getParameters

        @Nullable() abstract CachingParameters getParameters()

        The configuration of the task.

        • These parameters can not be modified after creating a task. Instead, a new task should be created with different parameters.
        Returns:

        The parameters of the caching task. (NonNull)

      • getDuration

         abstract double getDuration()

        The requested cached duration of the media, in seconds.

        • Returns -1 if the duration is not available yet.
        • Returns -1 while caching progressive media.
        Returns:

        The amount that will be cached, in seconds.

      • getBytes

         abstract long getBytes()

        The estimation of the amount this task will download and store, in bytes.

        • Returns -1 if the estimate is not available yet.
        Returns:

        the data estimation, in bytes.

      • getBytesCached

         abstract long getBytesCached()

        The amount downloaded and stored, in bytes.

        Returns:

        The amount of data downloaded and stored, in bytes.

      • getCached

        @NonNull() abstract TimeRanges getCached()

        The time ranges indicating the data which has been cached.

        Returns:

        The time ranges cached. (NonNull)

      • getSecondsCached

         abstract double getSecondsCached()

        The amount of content that has been cached.

        • Returns 0 while caching progressive media.
        Returns:

        The duration cached, in seconds.

      • getPercentageCached

         abstract double getPercentageCached()

        The percentage of content that has been cached.

        Returns:

        The percentage cached, between 0 and 1.

      • getStatusNotificationId

        @Nullable() abstract Integer getStatusNotificationId()

        The notification identifier of the task when showing its status notification.

        • The identifier is null when the task has not been started yet.
        Returns:

        The notification identifier of the task. (Nullable)

      • getProgressNotificationId

        @Nullable() abstract Integer getProgressNotificationId()

        The notification identifier of the task when showing its progress notification.

        • The identifier is null when the task has not been started yet.
        Returns:

        The notification identifier of the task. (Nullable)

      • start

        @RequiresPermission(value = "android.permission.FOREGROUND_SERVICE_DATA_SYNC", conditional = true) abstract void start()

        Start caching the media.

        • The permission `android.permission.FOREGROUND_SERVICE_DATA_SYNC` is required to be added in the application AndroidManifest.xml
        • A manifest or segment will only be cached if it is not yet present in the cache.
      • pause

         abstract void pause()

        Pause caching the media.

        • Segments that are currently being downloaded will still be completed and stored.
        • A paused task can be resumed with start.
      • remove

         abstract void remove()

        Remove the cached media.

        • A manifest or segment referenced by multiple tasks will only be evicted if all associated tasks are removed.