CachingTask_Objc
@objc(THEOplayerCachingTask)
public protocol CachingTask_Objc
Represents a caching task.
-
The identifier of the task.
Declaration
Swift
var id: String { get }
-
The current
CachingTaskStatus
.Declaration
Swift
var status: CachingTaskStatus { get }
-
The
SourceDescription
processed by this caching task.Declaration
Swift
var source: SourceDescription { get }
-
The
CachingParameters
for this caching task.Remark
These parameters can not be modified after creating a task. Instead, a new task should be created with different parameters.Declaration
Swift
var parameters: CachingParameters { get }
-
The amount of content that will be available after this task has finished, in seconds.
Declaration
Swift
var duration: Double { get }
-
The amount of content that has already been cached, in seconds.
Declaration
Swift
var secondsCached: Double { get }
-
The percentage of content that has already been cached, between 0 and 1.
Declaration
Swift
var percentageCached: Double { get }
-
The amount of bytes that have already been cached.
Declaration
Swift
var bytesCached: UInt { get }
-
Starts downloading the stream and stores it on the device.
Remark
An element will only be cached if it is not yet present in the cache.Declaration
Swift
func start()
-
Removes the task and tries to evict all associated streaming elements.
Remark
An element referenced by multiple tasks will only be evicted if all associated tasks are removed.Declaration
Swift
func remove()
-
Pauses downloading the stream.
Remark
- The cachingtask can be resumed later on through the use of the
start()
method. - This how-to-guide explains how to save the progress of a task and what the limitations are: https://docs.theoplayer.com/how-to-guides/07-miscellaneous/10-saving-cachingtask-progress-ios.md
Declaration
Swift
func pause()
- The cachingtask can be resumed later on through the use of the
-
A controller for license related queries and operations.
Declaration
Swift
@objc(license) var license_Objc: CachingTaskLicense_Objc { get }
-
Adds the event listener of the given
EventType
.Remark
When attaching a listener on the wrong object, the application will crash.
Declaration
Swift
@discardableResult func addEventListener(type: String, listener: @escaping (CacheEvent) -> ()) -> EventListener
Parameters
type
EventType
of the added event listener. SeeCachingTaskEventTypes
for possible values.listener
Closure called when event is dispatched.
Return Value
The newly added
EventListener
. -
Removes the event listener of the given CachingTaskEventType.
Declaration
Swift
func removeEventListener(type: String, listener: EventListener)
Parameters
type
EventType
of the event listener to be removed. SeeCachingTaskEventTypes
for possible values.listener
EventListener
which was added byaddEventListener(...)