-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlayerAudioBookType.kt
124 lines (91 loc) · 3.4 KB
/
PlayerAudioBookType.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package org.librarysimplified.audiobook.api
import io.reactivex.Observable
import org.librarysimplified.audiobook.manifest.api.PlayerManifest
import org.librarysimplified.audiobook.manifest.api.PlayerManifestReadingOrderID
import org.librarysimplified.audiobook.manifest.api.PlayerManifestTOC
import java.io.Closeable
import java.util.concurrent.CompletableFuture
/**
* An instance of an audio book. The audio book must be closed when it is no longer needed.
*/
interface PlayerAudioBookType : Closeable {
/**
* `true` if [close] has been called
*/
val isClosed: Boolean
/**
* A unique identifier for the book.
*/
val id: PlayerBookID
/**
* True iff the underlying audio book supports streaming. That is, it's not necessary to download
* a book part before it's possible to play that part.
*/
val supportsStreaming: Boolean
/**
* True iff the underlying audio engine supports the deletion of individual chapters via
* the PlayerDownloadTaskType interface. If this is false, local book data may only be
* deleted via the `deleteLocalChapterData` method.
*/
val supportsIndividualChapterDeletion: Boolean
/**
* True iff the underlying audio engine supports the download of individual chapters via
* the PlayerDownloadTaskType interface. If this is false, books may only be downloaded using
* the [wholeBookDownloadTask].
*/
val supportsIndividualChapterDownload: Boolean
/**
* The list of reading order items in reading order.
*/
val readingOrder: List<PlayerReadingOrderItemType>
/**
* The list of download tasks for each available audiobook file.
*/
val downloadTasks: List<PlayerDownloadTaskType>
/**
* The list of download tasks for each available audiobook file.
*/
val downloadTasksByID: Map<PlayerManifestReadingOrderID, PlayerDownloadTaskType>
/**
* The reading order items organized by their unique IDs.
*/
val readingOrderByID: Map<PlayerManifestReadingOrderID, PlayerReadingOrderItemType>
/**
* An observable publishing changes to the current download status of the part.
*/
val readingOrderElementDownloadStatus: Observable<PlayerReadingOrderItemDownloadStatus>
/**
* Create a player for the audio book. The player must be closed when it is no longer needed.
*/
fun createPlayer(): PlayerType
/**
* A download task that downloads all chapters and can also be used to delete local book data.
*/
val wholeBookDownloadTask: PlayerDownloadWholeBookTaskType
/**
* Replace the current manifest with a new manifest.
*
* Implementations are permitted to ignore new manifests if the underlying audio engine does not
* support replacing manifests.
*
* Implementations are permitted to ignore any information in the new manifest that cannot be
* reasonably expected to replace existing information.
*
* Implementations are permitted to ignore manifests that are in some way invalid, such as not
* having the same number of spine elements as the existing loaded manifest.
*
* Implementations are required to reject manifests that do not have the same identifier as the
* old manifest.
*
* @see [id]
*/
fun replaceManifest(manifest: PlayerManifest): CompletableFuture<Unit>
/**
* @return The table of contents generated from the manifest
*/
val tableOfContents: PlayerManifestTOC
/**
* The most recent manifest
*/
val manifest: PlayerManifest
}